Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Create 1 or more collections / power automate calls (with collection) depending on amount selected

(0) ShareShare
ReportReport
Posted on by 80
I've got a PowerApp which is integrated in a PowerBI.
In the PowerBI I can select records until a max of 1000 (which is still the max for the integration i think).
In the PowerApp I am displaying the records in a gallery and I should be able to add a remark in 1 field and pass all as a json to a power automate flow.
As the flow will trigger a HTTP Call, I need to send batches of max 250 records. 

First I thought I had a solution (which was terrible, but worked, but apparently it doesnt work....)
In this case I would create a collection of the first 200 records and send this to my power automate. (also have it for third, fourth and fifth)
This works for my 1000 records, but when only 3 items are in the gallery it also executes this for all 5 galleries. 
There will be plenty of ideas for this i guess, but none of them come into my mind. Someone got an idea? 
 
If(IsError(ClearCollect(colFirst200ListItem,FirstN(ForAll(Gallery2.AllItems,{dataProcessingID:DataProcessingID,productID:ProductID,approverEmail:User().Email,userRemark:TextInput1_1.Text,approvalStatus:"Rejected",pricelistType:"Vendor",approvalTime:Text(Now(),DateTimeFormat.UTC)}),200))
),Notify("Error: Could not create the collection", NotificationType.Error));
If(CountRows(colFirst200ListItem)>0,
If(IsError(SendtoAPI.Run(JSON(colFirst200ListItem,JSONFormat.IgnoreBinaryData & JSONFormat.IgnoreUnsupportedTypes))),
Notify("Unexpected error happened, please send the following to : ",NotificationType.Error),Notify("Message sent successful!",NotificationType.Success););
);
If(IsError(ClearCollect(colSecond200ListItem,FirstN(LastN(ForAll(Gallery2.AllItems,{dataProcessingID:DataProcessingID,productID:ProductID,approverEmail:User().Email,userRemark:TextInput1_1.Text,approvalStatus:"Rejected",pricelistType:"Vendor",approvalTime:Text(Now(),DateTimeFormat.UTC)}),400),200))
),Notify("Error: Could not create the collection", NotificationType.Error));
If(CountRows(colSecond200ListItem)>0,
If(IsError(SendtoAPI.Run(JSON(colSecond200ListItem,JSONFormat.IgnoreBinaryData & JSONFormat.IgnoreUnsupportedTypes))),
Notify("Unexpected error happened, please send the following to : ",NotificationType.Error),Notify("Message sent successful!",NotificationType.Success););
);
 
Summary: I've got a gallery with 0-1000 records. When selecting a few it should create 1 collection and send it to powerbi, when selecting > 250 records it should send 2-5 collections to power automate. How can i create this in a much smarter and better way?
Categories:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,422

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,711

Leaderboard