I'm struggling with patch and error handling sequence ! I've no errors all is working but just not in the order I want ! 🙂
So I have multiple patch functions to different lists, they are sequentially done separated by ;
If first patch fails for what ever reason I want to catch the errors in the in a collection , show a message and don't continue the sequence and they can try again. Sounds easy and that part is ! got that working fine. However I want to do 3 things if the first patch fails and I can't do them concurrently (when I can put concurrent infront of the actions it works fine) The way I have it set up now if the first patch fails then it does all the things it's supposed to do but then it goes and sends the second patch ! I don't want that.. so I' know it's a matter of changing where brackets and syntax is but just don't know how to do it ! here's what I currently have
Patch1 Actions ending with ;
If(!IsEmpty(Errors('mydatasource')),
Concurrent(Set(snothervariable,false),
UpdateContext({adialoguebox:true}),
Collect(myerrorcollection,AddColumns(Errors('mydatasource'),
column1,"text1",
column2,"text2",
TimeStamp,Now()
)))
;SaveData(myerrorcollection,"LocalErrors");
ForAll(myerrorcollection,Patch(
'anerrorlogdatasource',
Defaults('anerrorlogdatasource'),
{column1:text1,
column2:text2,
ErrorMessage:Message,
ErrorCode:Error,
TimeStampOfError:TimeStamp
})
),
2nd patch acion here...
So as I said above all works but it appears to send the 2nd patch action even if the first one doesn't work... If remove the collection and save local data and any ; just concurrently doing stuff it works as expected...
hopefully you can follow the above !
TIA