cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FernandB
Helper II
Helper II

ResetForm not working in datacardvalue with a variable as the default.

Hello,

 

The OnSelect of a button in my app Set(varM1P,varM1P+1) to count in a DatacardValue. The Default is varM1P. The forms do not reset at all after a submit.

 

 

FernandB_0-1618355536050.png

FernandB_1-1618355586498.png

 

OnSelect of Submit:


Set(
ChoiceVar,
{Value: "Open"}
);
Patch(
'Hand Hygiene Audit App',
varRecord,
Form1.Updates,
Form2.Updates,
Form3.Updates
);
ResetForm(Form1);
ResetForm(Form2);
ResetForm(Form3);
Navigate(
ScreenStart,
ScreenTransition.Fade
)

 

1 ACCEPTED SOLUTION

Accepted Solutions

@FernandB ,

Actually you will need 0 - so

Set(varM1P,0)

and 

If(
   varM1P>0,
   varM1P,
   YourOtherValue
)

This is a logic, not a coding exercise and I cannot see your model. If this does not do what you need, please have a think about the direction you might take - happy to assist.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

14 REPLIES 14
WarrenBelz
Super User
Super User

Hi @FernandB ,

Have you tried resetting the control as well?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @warren,
 

Like this? Reset(DataCardValue11)?

@FernandB ,

Yes, if that is the name of the control (not the card) containing the data you want reset.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

I tried that and it does not work. I am wondering if it has to do with the Default in the control is a variable. I know I can reset the variable but doing so removes existing values of records in my gallery. 

@FernandB ,

No - it should not - I use Variables regularly as conditional defaults and it always works on Reset. You can however go the direction

If(
   !IsBlank(Variable),
   Variable,
   YourOtherValue
)

then set the Variable to Blank() or a Value and reset the control.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Do I set the variable to Blank on submit? I tried this but when I go back into the gallery to view an item the data is still there.

@FernandB ,

Actually you will need 0 - so

Set(varM1P,0)

and 

If(
   varM1P>0,
   varM1P,
   YourOtherValue
)

This is a logic, not a coding exercise and I cannot see your model. If this does not do what you need, please have a think about the direction you might take - happy to assist.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

The OnSelect of a button in my app Set(varM1P,varM1P+1) to count in a DatacardValue11.

 

FernandB_2-1618442506449.png

 

The Default for DataCardValue11 was varM1P but I entered what you provided
If( !IsBlank(varM1P), varM1P, 0 )

 

FernandB_1-1618442283722.png

 

Below is what I have in the OnSelect property of my Save button.

FernandB_3-1618442682429.png

 

The item in the gallery shows the count which is 3 in this case but when I select it I see previous data from another record.

Set(varMode,"Edit"); Set(varRecord, ThisItem);Set(varID,ThisItem.ID);Refresh('Hand Hygiene Audit App'); Navigate('Screen1.1')

FernandB_5-1618442974544.png

This is an audit app where there is a save and submit button. If they submit the item will not show in the gallery but when they save it does, allowing the user to resume the audit. When I set the variable to 0 after the Patch it removes data in fields of in the gallery. I know this is because it is a global variable.

 

On the Home Screen I have a Start button with the following.
Set(varMode,"New");Set(varID,0);Set(VarStatus,"Open");NewForm(Form1);NewForm(Form2);NewForm(Form3);Navigate(Screen1,ScreenTransition.Fade)

 

And a browse button with the following:
Set(varMode,"Edit"); Navigate(ScreenBrowse,Fade)

 

 

 

 

 

@FernandB ,

As I said this is a logic exercise and the zero probably will not do what you want after seeing more of your structure. Going right back to basics here, you have a control that has a Variable as a Default and you want to reset it. Normally, resetting the control would simply make it show the current value of the Variable - have you put a label on the screen to track the Variable value as you progress?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,118)