cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Reset GALLERY after Patch does not work

Hi all. After patching my gallery (OnSuccess of the form) I would like to reset the visibility of the gallery to false. The gallery itself is only visible (or at least should be) if the dropdown "Zeiterfassung" is selected to "Manuell". 

 

After saving and navigating to an other screen, coming back, the form is updated/new, but the gallery is new, but unfortunately visible... 

Has anyone an idea where I made an error?

 

Gallery Visible: If(Dropdown12.Selected.Result = "Manuell", true, false)

 

Speicher/Save Button: SubmitForm(Form4); Navigate(TagesrapportViewWeek)

Form OnSuccess:
ForAll(CollectionTagesrapport, If(!IsBlank(STARTZEIT),Patch(TagesrapportManuell, Defaults(TagesrapportManuell), {ArbeitPause: ARBEITPAUSE, StartZeit: STARTZEIT, EndeZeit: ENDZEIT, IDDatenApp: Form4.LastSubmit.ID})));
NewForm(Form4);
ClearCollect(CollectionTagesrapport, {
ARBEITPAUSE: "",
STARTZEIT: "",
ENDZEIT: "",
SHOWSAVEBUTTON: true}
);
Gallery4.Visible = false;
Label34.Visible = false; 

 

 

Unbenannt.PNG

2 ACCEPTED SOLUTIONS

Accepted Solutions
notj
Post Prodigy
Post Prodigy

It looks like you're trying to set the visibility of the gallery when the Form OnSuccess goes through? PowerApps doesn't really work like that. You can't directly change an object from another like that.

 

Set the visibility of the gallery to a variable, and then change the variable from true to false in the OnSuccess.

View solution in original post

RandyHayes
Super User
Super User

@Marc_Gutzwiller 

In your OnSuccess action you are lastly trying to set the Visible properties of Gallery4 and Label34 to false.  You cannot assign properties like that in PowerApps.  PowerApps derives its values from formulas.

Those two lines become simple evaluations that return a true or a false and have no impact on your controls.

 

What you can do is to utilize a variable like : Set(controlsVisible, false)

And then in the Label34 and Gallery4 controls, set the Visible property formula to controlsVisible

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
notj
Post Prodigy
Post Prodigy

It looks like you're trying to set the visibility of the gallery when the Form OnSuccess goes through? PowerApps doesn't really work like that. You can't directly change an object from another like that.

 

Set the visibility of the gallery to a variable, and then change the variable from true to false in the OnSuccess.

RandyHayes
Super User
Super User

@Marc_Gutzwiller 

In your OnSuccess action you are lastly trying to set the Visible properties of Gallery4 and Label34 to false.  You cannot assign properties like that in PowerApps.  PowerApps derives its values from formulas.

Those two lines become simple evaluations that return a true or a false and have no impact on your controls.

 

What you can do is to utilize a variable like : Set(controlsVisible, false)

And then in the Label34 and Gallery4 controls, set the Visible property formula to controlsVisible

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

thank you very much @RandyHayes  and @notj. With this information I was able to finish this bit of my app 🙂

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,981)