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 / Split Collection into ...
Power Apps
Unanswered

Split Collection into smaller Collections based on SQL lookup data

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm really struggling with this...

 

I start with a collection: ScanDataCollection_SmartComm_MasterList

 

It looks like this:

Result
REQ1991799.RITM2280596.01
REQ2048874.RITM2349401.01
REQ2037354.RITM2335400.01

I have a database table: Master_Transaction_Log

 

...which has three particular columns of interest:

 

Timestamp
Scan_Code
Transaction_Type

I would like to end up with TWO collections:

SC_ReturnToDepot
Result
REQ1991799.RITM2280596.01

SC_Remainder_1
Result
REQ2048874.RITM2349401.01
REQ2037354.RITM2335400.01


The criteria is as follows: for any given Result in ScanDataCollection_SmartComm_MasterList, if:

 

A database record has Scan_Code = Result AND Transaction_Type = "New Equipment Delivery - Cust. Msg: Equipment Returning to Depot" AND Timestamp > 72 hours ago, then that value of Result is added to SC_ReturnToDepot.

 

SC_Remainder_1 are all remaining values that do not fit the above criteria.

 

I've narrowed this down to one single line...

 

A sample of my code, with three examples:

 

ForAll(ScanDataCollection_SmartComm_MasterList,
If(
// line 1 (LookUp(Master_Transaction_Log, Result in Scan_Code).Scan_Code) in Result,
// line 2 (LookUp(Master_Transaction_Log, "Comms Lockoff" in Transaction_Type).Scan_Code) in Result,
// line 3 (LookUp(Master_Transaction_Log, "Comms Lockoff" in Transaction_Type And Result in Scan_Code).Scan_Code) in Result,
Collect(SC_OnCommsHold,ThisRecord),
Collect(SC_Remainder_1,ThisRecord));
);

 

My database has one single entry that fits the above criteria.

 

  • When I uncomment only line 1, the routine runs great. SC_OnCommsHold receives one record, and SC_Remainder_1 gets the other three.
  • When I uncomment only line 2, the routine runs great. SC_OnCommsHold receives one record, and SC_Remainder_1 gets the other three.
  • When I uncomment only line 3, the result fails. SC_OnCommsHold receives no records. All records get piled into SC_Remainder_1

 

It seems to me like it's got to be some sort of logical error in line 3, but I an absolutely baffled.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard