cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Clear form viewer when starting the app

Hi Everyone,

Teaching myself powerapps and want to create a simple add new user request. The app is connected to SharePoint Online List.

I have a home screen with a button to start the new user request and below it is a form viewer that I want to be not visible on start but when the request is submitted shows the latest list entry which should be the one the user just entered.

On the FormViewer Item field I have - Last(Sort('New Users',ID,Ascending)). This gives me the latest user created but it carries over to the next time the app is started.

 

Any advice would be appreciated.

 

FormViewerFormViewer

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Clear form viewer when starting the app

@Greg-au 

You can use a context variable to either true or false as the result of a condition.   If you want it hidden by default, then in the OnVisible property of the  Screen containing the Viewform put

 

UpdateContext({visvar:false})

 

Then set the Visible property of the FormViewer to visvar. 
The SubmitForm icon should never have anything other than SubmitForm(FormX) as its OnSelect property.  The OnSuccess property of the form itself is be used to change the context variable.  This formula should be in the OnSuccess property of the form

 

UpdateContext({visvar:true})

 

That way, the form would not be shown unless the form was successfully submitted.  As soon as the data is successfully submitted, the View form would be unhidden.  If you had an Edit form on the same screen, then the Edit form Visible property would be set to !visvar.  That would toggle the View form and and Edit form so either one or the other was hidden when the other form was visible. 

Another trick is to create a toggle button that hides and unhides the forms.  The OnSelect property of a button or Icon with the formula

UpdateContext({visvar:!visvar})

would do that.  

  

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Clear form viewer when starting the app

@Greg-au 

To avoid delegation problems you want First(Sort('New Users',ID,Descending)).  Your formula will max out at 2000 names (if you have increased File>Settings>Advanced Settings>Data row limit to 2000 from the default of 500.  

Highlighted
New Member

Re: Clear form viewer when starting the app

@Drrickryp , Thanks for responding and will look at that change.

Any advice on how to have the formviewer not visible until a user has submitted a request?

By default I have FormViewer1 set to visible=false

I was looking at the submit form icon and trying to figure out how to then set FormViewer1 to visible to show/confirm what they just requested.

I have tried SubmitForm(EditForm1); FormViewer1.Visible=true

Any thoughts

Highlighted
Super User III
Super User III

Re: Clear form viewer when starting the app

@Greg-au 

You can use a context variable to either true or false as the result of a condition.   If you want it hidden by default, then in the OnVisible property of the  Screen containing the Viewform put

 

UpdateContext({visvar:false})

 

Then set the Visible property of the FormViewer to visvar. 
The SubmitForm icon should never have anything other than SubmitForm(FormX) as its OnSelect property.  The OnSuccess property of the form itself is be used to change the context variable.  This formula should be in the OnSuccess property of the form

 

UpdateContext({visvar:true})

 

That way, the form would not be shown unless the form was successfully submitted.  As soon as the data is successfully submitted, the View form would be unhidden.  If you had an Edit form on the same screen, then the Edit form Visible property would be set to !visvar.  That would toggle the View form and and Edit form so either one or the other was hidden when the other form was visible. 

Another trick is to create a toggle button that hides and unhides the forms.  The OnSelect property of a button or Icon with the formula

UpdateContext({visvar:!visvar})

would do that.  

  

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,305)