Hi. Suppose I have a table called "My Table" like this:
ID(Auto generated) | Ball Number | Student_ID | Item_ID | Value |
1 | 2 | 1234 | 12 | |
2 | 2345 | 13 |
I'd like to patch the "Value" column of all the records based on whether the "Ball Number" column is blank. If it is blank, the "Value" should be Concatenate(Student_ID, Item_ID), but if it is not blank, the "Value" should be just the Student_ID.
I tried to use the following formula to achieve what I want:
ForAll('My Table', Patch('My Table', LookUp('My Table', ID=ThisRecord.ID), {
Value: If(!IsBlank(ThisRecord.'Ball Number'), ThisRecord.Student_ID, Concatenate(ThisRecord.Student_ID, ThisRecord.Item_ID))
}
But it keeps telling me "the function cannot operate on the same datasource that is used in Forall". I have read https://powerusers.microsoft.com/t5/Building-Power-Apps/Patch-the-same-data-source-as-in-Forall-loop... but I still have no idea how to make my code work. Can anyone help me? Thanks!
Solved! Go to Solution.
Rather than call ForAll, you can call UpdateIf to do a conditional update.
https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-update-updateif
UpdateIf('My Table',
IsBlank('Ball Number'),
{Value:Concatenate(Student_ID, Item_ID)}
)
Rather than call ForAll, you can call UpdateIf to do a conditional update.
https://docs.microsoft.com/en-gb/powerapps/maker/canvas-apps/functions/function-update-updateif
UpdateIf('My Table',
IsBlank('Ball Number'),
{Value:Concatenate(Student_ID, Item_ID)}
)
Thanks!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
200 | |
100 | |
62 | |
59 | |
58 |
User | Count |
---|---|
254 | |
164 | |
90 | |
79 | |
70 |