Hi All,
Happy Holidays!!!
I have an App on top of an SPO list. I set the Item number to be unique in the list. I have an error in the app if you try to submit a duplicate item number.
I set my edit button to only be visible for items added today. but if I go to edit an existing item, I get the duplication error and I can not submit the form.
how do I differentiate between an update to an existing as opposed to adding a new item?
Thanks,
Joe
Solved! Go to Solution.
Yes, of course. We can check if the FormMode is Edit using a logical statement.
Form1.Mode=FormMode.Edit
It can be used within an IF statement like this
If(Form1.Mode=FormMode.Edit, some_code_true, some_code_false)
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
The way to differentiate between inserting a new row and updating an existing row are the NEWFORM and EDIT form functons respectively. Typically you would use these functions in the OnSelect property of a button used to navigate to the Form.
NewForm(your_form_name);Navigate(your_screen_name);
EditForm(your_form_name);Navigate(your_screen_name);
Link To MS Documentation for Forms
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-form
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Hi @mdevaney ,
I hit send too soon, I left out the code that is stopping me from continuing...
on the submit button, I check to make sure the location number = the 1st 3 digits of deposit number, then I check to see if the item is in the list. Is there a way to check if I am editing before checking?
If(
LocationValue.Text <> Left(DepoNumberValue.Text,3),
Notify("The Location you entered does not match the deposit slip number, please make sure your location is 3 digits and match the first 3 digits of the deposit slip number and try again", NotificationType.Warning),
IsBlank(
LookUp('Edison Deposit Entry', 'Deposit Slip Number' = DepoNumberValue.Text).'Deposit Slip Number'
),
// If its blank then there's no existing value with that same value so submit
SubmitForm(EditForm1)
,
// If its not blank then let the user know and switch focus to that field
Notify("The deposit slip you entered is already in the system, please check your number and try again", NotificationType.Warning);
SetFocus(DepoNumberValue)
)
Thanks again,
Joe
Yes, of course. We can check if the FormMode is Edit using a logical statement.
Form1.Mode=FormMode.Edit
It can be used within an IF statement like this
If(Form1.Mode=FormMode.Edit, some_code_true, some_code_false)
---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
203 | |
180 | |
62 | |
32 | |
30 |
User | Count |
---|---|
324 | |
269 | |
104 | |
74 | |
56 |