web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Merge few large collec...
Power Apps
Answered

Merge few large collections collected from SharePoint but the Collection return empty rows

(0) ShareShare
ReportReport
Posted on by 14

I merged 3 large data collection into one final collection. I use this method because I have large data from multiple SP list to pull from and to store it in multiple collection first and to merge the collection into one final collection.

 

I have merge few collections collected from SharePoint but the final collection return empty rows instead (Image 1). I have to click a value column in the collection view in PowerApps tab to expand collection rows (Image 2 & 3). The 3 collections before merging all returned correct collection with data inside it. Only the final one after merging return empty rows. Refer image below:

 

Final collection:

 

Image 1

StrategyInnov_0-1680513549669.png

 

After clicking value column in PowerApps collection view

 

Image 2

StrategyInnov_1-1680513669156.png

 

The collection in a value column. I have to click the value column to expand the data in the final collection. It seems like the data is stored in the value column instead of the final collection. This never happen before.

 

Image 3

StrategyInnov_2-1680513775493.png

 

Anyone know why this is happening to the collection?

 

This is the sample of my code for the collection.

 

 

Collect(
 LargeListSP,
 Set(
 firstRecordMid,
 First(SP_Midnight)
 );
 Set(
 lastRecordMid,
 First(
 SortByColumns(
 SP_Midnight,
 "ID",
 SortOrder.Descending
 )
 )
 );
 Set(
 iterationsNoMid,
 RoundUp(
 (lastRecordMid.ID - firstRecordMid.ID) / 2000,
 0
 )
 );
 Collect(
 iterationsMid,
 Sequence(
 iterationsNoMid,
 0
 )
 );
 ForAll(
 iterationsMid,
 With(
 {
 prevThresholdmid: Value(Value) * 2000,
 nextThresholdmid: (Value(Value) + 1) * 2000
 },
 If(
 lastRecordMid.ID > Value,
 Collect(
 LargeListSP1,
 Filter(
 SP_Midnight,
 ID_Digit > prevThresholdmid && ID_Digit <= nextThresholdmid && DateDesignation >= DateFromGal.SelectedDate && DateDesignation <= DateToGal.SelectedDate
 )
 )
 )
 )
 ),
 Set(
 firstRecordAM,
 First(SP_AM)
 );
 Set(
 lastRecordAM,
 First(
 SortByColumns(
 SP_AM,
 "ID",
 SortOrder.Descending
 )
 )
 );
 Set(
 iterationsNoAM,
 RoundUp(
 (lastRecordAM.ID - firstRecordAM.ID) / 2000,
 0
 )
 );
 Collect(
 iterationsAM,
 Sequence(
 iterationsNoAM,
 0
 )
 );
 ForAll(
 iterationsAM,
 With(
 {
 prevThresholdAM: Value(Value) * 2000,
 nextThresholdAM: (Value(Value) + 1) * 2000
 },
 If(
 lastRecordAM.ID > Value,
 Collect(
 LargeListSP2,
 Filter(
 SP_AM,
 ID_Digit > prevThresholdAM && ID_Digit <= nextThresholdAM && DateDesignation >= DateFromGal.SelectedDate && DateDesignation <= DateToGal.SelectedDate
 )
 )
 )
 )
 ),
 Set(
 firstRecordPM,
 First(SP_PM)
 );
 Set(
 lastRecordPM,
 First(
 SortByColumns(
 SP_PM,
 "ID",
 SortOrder.Descending
 )
 )
 );
 Set(
 iterationsNoPM,
 RoundUp(
 (lastRecordPM.ID - firstRecordPM.ID) / 2000,
 0
 )
 );
 Collect(
 iterationsPM,
 Sequence(
 iterationsNoPM,
 0
 )
 );
 ForAll(
 iterationsPM,
 With(
 {
 prevThresholdPM: Value(Value) * 2000,
 nextThresholdPM: (Value(Value) + 1) * 2000
 },
 If(
 lastRecordPM.ID > Value,
 Collect(
 LargeListSP3,
 Filter(
 SP_PM,
 ID_Digit > prevThresholdPM && ID_Digit <= nextThresholdPM && DateDesignation >= DateFromGal.SelectedDate && DateDesignation <= DateToGal.SelectedDate
 )
 )
 )
 )
 )
)

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,752 Most Valuable Professional on at

    Hi @StrategyInnov ,

    I have not seen that code structure before, but you might try this one to collect all the records in your lists.

  • StrategyInnov Profile Picture
    14 on at

    Thanks @WarrenBelz ,

     

    However, how do I do this with multiples SP list to collect data from? For example in this case, I have 3 SP lists; SP_Midnight, SP_AM, SP_PM. Do I repeat this code three times and merge those three collections using ClearCollect?

     

    *note

    I managed to collect from all 3 SP lists (SP with same structure and data type) and the collection returned with the correct data, the problem is when I try to merge these 3 collections into one collection, the final one returned blank rows like Image 1 above.

     

    To add, do I have to use Ungroup?

  • WarrenBelz Profile Picture
    155,752 Most Valuable Professional on at

    Hi @StrategyInnov ,\

    Yes - you would collect the three of them and then create another collection out of the output.

    I honestly have no hope of getting my mind around that structure you are using, however it appears you have one column (a Table called Value), so you need to use 

    Ungroup(CollecitonName,"Value")

    and see what the output is - warning here the output of Ungroup is subject to your Delegation limit.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Verified answer
    StrategyInnov Profile Picture
    14 on at

    I managed to tweak the solution you have given previously and managed to get the data into 3 separate collections. I use ClearCollect to merge those three collections into one big final collection. Thanks @WarrenBelz 

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 474

#1
Valantis Profile Picture

Valantis 474

#3
WarrenBelz Profile Picture

WarrenBelz 375 Most Valuable Professional

Last 30 days Overall leaderboard