Hi,
I have this code in the Onselect property of submit button:
If(
IsEmpty(
Errors(
'Project Request (Projects@Mayk.com)',
Patch(
'Project Request (Projects@Mayk.com)',
Defaults('Project Request (Projects@Mayk.com)'),
{
Title: txtInputTitle.Text,
'Team Project Type': drpTeamType.Selected,
'Sub Project Of': drpSubproject.Selected,
'Request State': drpRequest.Selected,
Priority: drpPriority.Selected,
'Start Date': dpkStartDate.SelectedDate,
'Due Date': dpkDueDate.SelectedDate,
'Market Live Date': dpkLive.SelectedDate,
'Billing Comments': txtInputComment.Text,
Fixed_Fee_Amount: Value(txtInputFee.Text),
'Project Type': drpProjectType.Selected,
Billing_Type: drpBillingType.Selected,
Company: drpClients.Selected,
Bill_To_Client: drpBillToClient.Selected,
'Project Sponsor': CmdSponsor.SelectedItems,
Bill_To_Person: drpBillToName.Selected
}
)
)
),
Notify(
"Patch Succes",
NotificationType.Success
),
Notify(
"Patch Fail",
NotificationType.Error
)
);
I want to reset any item to default value and I used this formula for each item:
reset.drpclients.selected
It does not give me any error but it does not work.
Can help me with that?
Solved! Go to Solution.
You can actually use a form in your app without the user ever seeing it or interacting with it. Forms provide so much for you and take so much time out of your app design work and troubleshooting.
I have a video on Forms and everything you ever wanted to know about forms. It is a long video, but very comprehensive and it is indexed so you can review only certain parts. Particularly, this section on "Super Forms" uses a Form as the back end for all the data actions but the users never see that form and they all interact with a completely custom look (very custom look!)
So, don't discount forms just because you have a custom look. The form is the most powerful component in PowerApps! It will do SO much for you that you otherwise
So for the other video I sent you, yes, that one uses a toggle to reset the entire screen. It is meant for doing more than just a simple reset of the controls, it is meant to also be a place where you can isolate formulas that need to reinitialize or do other actions.
The toggle is hidden from users - it is not meant to be visible.
But, in your scenario, you really only need to use the this after your patch statement:
UpdateContext({lclResetFields: true}); UpdateContext({lclResetFields: false})
And you just need to put lclResetFields in the Reset property of all of your controls that you want to reset.
You cannot set a property directly like that in PowerApps. The reset action needs to be used, or you need to have the Reset property of each control respond to some other value.
Personally, I don't like to repeat any formulas when designing an app, so I would opt to create a control to do all of this for you.
I have a video on doing resets that would be interesting to view.
In general, you can use a variable to "fire" the reset. So, at the end of your long Patch formula (you might want to consider using a form rather than a long patch statement like that), you would put a statement such as this: UpdateContext({lclResetFields: true}); UpdateContext({lclResetFields: false})
Then, in the Reset property of all of your controls, set the property to : lclResetFields
They will all reset then when you do this.
I hope this is helpful for you.
Hi,
The reason that I didn't use the form was that I need a custom design like having different sections, to be able to identify left or right columns manually, etc and I didn't know how to do that with Form.
I watched your video but I don't want to put extra control in the app since it is not user-friendly for the clients and I have not seen an extra button to clear the data in the app. Usually, data will back to default after submission.
for the variable in the Reset property of each item I just need to put this variable or set it to false or true?
You can actually use a form in your app without the user ever seeing it or interacting with it. Forms provide so much for you and take so much time out of your app design work and troubleshooting.
I have a video on Forms and everything you ever wanted to know about forms. It is a long video, but very comprehensive and it is indexed so you can review only certain parts. Particularly, this section on "Super Forms" uses a Form as the back end for all the data actions but the users never see that form and they all interact with a completely custom look (very custom look!)
So, don't discount forms just because you have a custom look. The form is the most powerful component in PowerApps! It will do SO much for you that you otherwise
So for the other video I sent you, yes, that one uses a toggle to reset the entire screen. It is meant for doing more than just a simple reset of the controls, it is meant to also be a place where you can isolate formulas that need to reinitialize or do other actions.
The toggle is hidden from users - it is not meant to be visible.
But, in your scenario, you really only need to use the this after your patch statement:
UpdateContext({lclResetFields: true}); UpdateContext({lclResetFields: false})
And you just need to put lclResetFields in the Reset property of all of your controls that you want to reset.
Thanks a lot for all the info. I will design my next app with the aid of Form definitely. I didn't know too much about the form.
I used the variable and it worked.
Appreciate your help
Yes, one of the number one things to learn in PowerApps is the Form. That video I mentioned on the forms will give you everything you need to know...and more!
User | Count |
---|---|
259 | |
111 | |
97 | |
48 | |
41 |