Is it possible to conditionally supply datasource to a patch statement? I have tried by inserting a switch and also using With but Patch returns an error.
I managed to do this with Remove so not sure why it isn't working with Path. I think this would be useful rather than needing to write out multiple patch statements in an IF statement.
I even tried putting the record to Patch inside a With and hoping to Patch the ThisRecord value as a way of not repeating the same record to be patched over and over, but that didn't work either.
Patch(
Switch(
dcLocation.Selected.Value,
"Loc1",List1,
"Loc2",List2,
"Loc3",List3,
"Loc4",List4,
List5,
),
gblSelectedRecord,
{Column1:"new value"}
)
This does not display an error...
Remove(
Switch(
dcLocation.Selected.Value,
"Loc1",List1,
"Loc2",List2,
"Loc3",List3,
"Loc4",List4,
List5,
),
{ID:gblSelectedRecord.ID}
)