Hi, I poked around with the following codes but still can't make it work. Can someone help?
Each Process is associated with multiple BOMs. I get the data from flow (SQL Sproc) and would like to associate the BOMs with the corresponding Process before displaying on the gallery.
Below doesn't work, but hope you get the idea:
ClearCollect(OpenProcesses,GetOpenWorkOrderProcessesBySourceType.Run("2"));
ClearCollect(OpenProcessBOMs,GetOpenWorkOrderProcessesBOMBySourceType.Run("2"));
UpdateContext({tempCollection: OpenProcesses}); //i need to create a temp collection so ForAll can work properly
ForAll(tempCollection,
Patch(OpenProcesses, ThisRecord,
{ BOM: Filter(OpenProcessBOMs, WorkOrderId = ThisRecord.WorkOrderId, SerialNumber = ThisRecord.SerialNumber)}
)
);
Where i think are problematic:
1. It seems like I can't create a new field "BOM" and make it associate to the Process item? If i simply set the changeRecord argument to {PONumber: Rand()} where PONumber is an existing field, the error message goes away.
2. I don't think I can use the Filter function inside Patch. It seems only prefer constant value. Then what should i do? All i want is to go through each item in my OpenProcesses collection, look up the BOM items that have the same WorkOrderId and SerialNumber with the current Process item, and stored this BOM list inside a new field called "BOM". When I build the "Process" gallery, i want to be able to do "ThisItem.BOM".
Thank you for your help!
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,004
Most Valuable Professional