Hi All,
Need your help to my formula using ForAll and Patch functions. I have a form in my app connected to Sharepoint list named 'Tracker' and the I have a 'Worker_ID' Column connected to Column ID of 'Masterlist' list in Sharepoint , this Column was set as required and can select multiple.
The idea is, if I selected one or multiple IDs, it will Patched in the Sharepoint list 'Tracker. 'I'm able to do both but the details are not accurate for multiple IDs.
If I selected multiple IDs, the details that my formula captures only the details of the last ID I've selected. Here's the formula I'm using.
Hope you could help me. Thank you!
Note: I store the IDs in a Collection named 'collID'.
That will not be a problem with this formula but rather a problem with the formula where you collect the different ID's could you share the code Please?
For the set problem this is the solution:
If(
CountRows(collID) = 1,
Patch(
'Tracker',Defaults('Tracker'),
{Title: Concatenate(Replace(strUniqueID,Find("[WDID]",strUniqueID),6,txtWorkdayID.Selected.Value), Text(Int(rowCount)+1)), 'Requested For': LookUp('Masterlist', 'Worker ID' = txtWorkdayID.Selected.Value, Title), 'Requested By':txtReqBy.Value, 'Workday ID': txtWorkdayID.Selected.Value, Item: txtItems.Selected, 'Request Type': txtReqType.Selected,'Specific Request Description':txtReqDesc.Value}
),
CountRows(collID) > 1,
Clear(rowCount);
ForAll(
collID,
Patch(
'Tracker',Defaults('Tracker'),{Title: Concatenate(Replace(strUniqueID,Find("[WDID]",strUniqueID),6,txtWorkdayID.Selected.Value), rowCount), 'Requested By': txtReqBy.Value,'Requested For': LookUp('8982 HK Ops Masterlist', 'Worker ID' = txtWorkdayID.Selected.Value,Title),'Workday ID': txtWorkdayID.Selected.Value,'Request Type':txtReqType.Selected, 'Specific Request Description': txtReqDesc.Value, Item: txtItems.Selected}
);
Collect(rowCount, {Value:CountRows(rowCount) + 1});
)
);
Got an error, Set is not working inside the ForAll function. But my problem is I'm not able to use the current data that the ForAll function processing.
Sample I have selected 2 IDs (ID1, ID2) in the Workday ID control in my Canvas App, I'm not be able to use the first data the Workday ID control (ID1) and it only reads the last ID selected (ID2). So my current formula was patching 2 items in my Tracker sharepoint list with the same details (ID2).
I want to Patch both IDs in the Sharepoint list.
Anyone can help me?
Hey Could you try this?
If(
CountRows(collID) = 1,
Patch(
'Tracker',Defaults('Tracker'),
{Title: Concatenate(Replace(strUniqueID,Find("[WDID]",strUniqueID),6,txtWorkdayID.Selected.Value), Text(Int(rowCount)+1)), 'Requested For': LookUp('Masterlist', 'Worker ID' = txtWorkdayID.Selected.Value, Title), 'Requested By':txtReqBy.Value, 'Workday ID': txtWorkdayID.Selected.Value, Item: txtItems.Selected, 'Request Type': txtReqType.Selected,'Specific Request Description':txtReqDesc.Value}
),
CountRows(collID) > 1,
ForAll(
collID,
Patch(
'Tracker',Defaults('Tracker'),{Title: Concatenate(Replace(strUniqueID,Find("[WDID]",strUniqueID),6,txtWorkdayID.Selected.Value), rowCount), 'Requested By': txtReqBy.Value,'Requested For': LookUp('8982 HK Ops Masterlist', 'Worker ID' = txtWorkdayID.Selected.Value,Title),'Workday ID': txtWorkdayID.Selected.Value,'Request Type':txtReqType.Selected, 'Specific Request Description': txtReqDesc.Value, Item: txtItems.Selected}
);
Set(rowCount, rowCount + 1);
)
);
Sure.
Here it is.
Hey @PABeginner26 ,
Could you please copy your code in here instead of a picture? This way we don't have to rewrite the whole thing.
thanks!
WarrenBelz
770
Most Valuable Professional
stampcoin
494
MS.Ragavendar
399