cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
russelln1
Helper III
Helper III

Reset a screen with a form and a gallery

Hi 

I have a screen with a Form and a Gallery - The gallery allows you to search the data and select the record you want and the Form will display the record that you've selected and allow you to edit and add certain bits and pieces in to it.

When I submit the edited Form I want the gallery and the form to reset ready for another search (it's not imperative but just makes it more professional looking and cleaner)

Datasource is Excel

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
SebS
Resolver II
Resolver II

Hello,

 

So Gallery is controlled by InputText field called SearchBox so to submit button add SubmitForm(Form1);ResetForm(Form1);Reset(SearchBox) that should restart Your control for gallery.

 

Regards

View solution in original post

9 REPLIES 9
timl
Super User
Super User

@russelln1 

Assuming that the Items property of the gallery is set to formula that references a search text input control, you can call the Reset function to reset the text input control.

In the OnSuccess property of your edit form, you would add the following line:

Reset(txtSearchTextBox)
SebS
Resolver II
Resolver II

Hello,

 

If you used a form in PowerApps you can submit your form using SubmitForm(Form1) and to reset it ResetForm(Form1). If you want to submit and reset just add to a button OnSelect  SubmitForm(Form1);ResetForm(Form1) to the button

 

Gallery should pick up any changes automatically from data source so I don't know what You mean by reset it.

 

Hope it helps

 

Regards

This only resets the form - when I say reset the gallery I mean it takes out the last search criteria that I entered in to it.

 

Hi @timl 

This is what I have in the Gallery Items Control:

Search(Table1,SearchBox.Text,"ReportingName", "ReportID", "Status")

 

SebS
Resolver II
Resolver II

Hello,

 

So Gallery is controlled by InputText field called SearchBox so to submit button add SubmitForm(Form1);ResetForm(Form1);Reset(SearchBox) that should restart Your control for gallery.

 

Regards

dhavalkankoshiy
Regular Visitor

Hello,

 

You create new variable and pass current item to that created variable on (e.g. Gallery1 OnSelect(varRecord, ThisItem)).

 

On form item replace Gallery selected item to variable item (e.g. form1 item Gallery1.Selected to varRecord)

dhavalkankoshiy_0-1656591151148.png

dhavalkankoshiy_1-1656591205985.png

 

On Edit form submit button you can clear variable record and Gallery1 (e.g.  onSelect of submit button set(varRecord, Blank);Reset(Gallery1)

 

Regards,

timl
Super User
Super User

@russelln1 

The edit form will have a property called OnSuccess. This is the formula that runs when the form is submitted sucessfully. By default, there may be some formula already there (for example, Back()).

 

timl_0-1656591682980.png

In the case that's something already there, you could append the call to Reset at the start of the formula.

Reset(SearchBox);
Back()

Reset(SearchBox) will clear the contents the search textbox and that should reset the gallery so that displays all records.

dhavalkankoshiy
Regular Visitor

You can write Reset(Gallery1) below Reset(SearchBox) so Gallery1 reset with new details.

 

That works exactly how I wanted it to - I also added 'ResetForm(Form2);Reset(SearchBox)'  to the main menu button and it works how I want it to there also.

Appreciate it

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,478)