OnSuccess of a .new form has the following:
Patch(colPunchListK2SD2021, Defaults(PunchListK2SD2021), FormNew.LastSubmit);
Set(varVisible,false);
ResetForm(FormNew);
Notify("Created!", NotificationType.Success, 2000);
Navigate(ScreenBrowse);
However, in the GalleryBrowse that picks up the colPunchListK2SD2021, the record shows previous values and not a blank value from the last submitted new record. Not sure if I misunderstand how LastSubmit works. Any thoughts here?
Solved! Go to Solution.
Noticed it seems to update my ID 1 item instead of adding a new item. Maybe this is a patch problem?
Now I changed my Defaults() to use the collection instead of the datasource I'm pulling from. Seems to work. Guess you can't patch a new record with another datasource's defaults?
Patch(colPunchListK2SD2021, Defaults(colPunchListK2SD2021), FormNew.LastSubmit);
Set(varVisible,false);
ResetForm(FormNew);
Notify("Created!", NotificationType.Success, 2000);
Navigate(ScreenBrowse);
@catpigeon do you want to add a blank record to the colPunchListK2SD2021? or do you want to add the last submitted values to the colPunchListK2SD2021?
Last Submit will add the last set of values added in the Form. You could also recreate colPunchListK2SD2021 to get the same result.
Want to add the last submitted form. It seems to add the last value from a few submissions ago if I leave a particular field blank. If I've left the field blank on the newly submitted form I don't want to patch a last submitted from a few days ago.
Is it possible that you have some default value that is getting populated?
Your assumption and usage seem to be correct, the other way you can do this is by creating colPunchListK2SD2021 again on Success using ClearCollect or Set functions.
No defaults for those particular fields. Just using clearcollect at app start and trying to get away from reloading database every time. Tried set variable then a patch the variable and the same result of patching last non blank data in a field from a few submissions ago. This is the OnSuccess of the FormNew:
Set(varNewLastSubmitted, FormNew.LastSubmit);
Patch(colPunchListK2SD2021, Defaults(PunchListK2SD2021), varNewLastSubmitted);
Set(varVisible,false);
ResetForm(FormNew);
Notify("Created!", NotificationType.Success, 2000);
Navigate(ScreenBrowse);
The LastSubmit logic seems to be per field per user and not per record. If I submit something new with some blank values it patches values from days ago in that field.
Noticed it seems to update my ID 1 item instead of adding a new item. Maybe this is a patch problem?
Now I changed my Defaults() to use the collection instead of the datasource I'm pulling from. Seems to work. Guess you can't patch a new record with another datasource's defaults?
Patch(colPunchListK2SD2021, Defaults(colPunchListK2SD2021), FormNew.LastSubmit);
Set(varVisible,false);
ResetForm(FormNew);
Notify("Created!", NotificationType.Success, 2000);
Navigate(ScreenBrowse);
You got that right! Defaults(PunchListK2SD2021) was giving an older record, and patching only the updated fields due to which the blank fields were coming from older values. Like I said your idea was correct, just the defaults() was wrong 🙂
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
277 | |
234 | |
82 | |
38 | |
37 |
User | Count |
---|---|
352 | |
240 | |
126 | |
72 | |
54 |