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?