cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Canadiansal
Helper V
Helper V

Nvigate to Form

I have an APP that has 2 Screens:

A main Screen and An Edit Screen.

 

The Main Screen displays all the records in a Gallery. When a user selects a record - I navigate the the edit screen:

Navigate(EditScreen,ScreenTransition.Fade)

On the Edit Screen I have a Form that has the selected record. The users can edit the record and click a Submit button:

SubmitForm(Form1);Navigate(MainScreen,ScreenTransition.Fade)

 

I would like to put the Form on the EditScreen on the Main screen - so the Application will have only 1 Screen, with 2 Forms.

How do I get this to work?

Here is the Concept:

Canadiansal_0-1611241309956.png

Additionally, since there will be about 10 records in the Left form - is there a way that the users can know which record they have already edited?

OR, can they edit the records directly in the left Form - without having to launch a second form?

 

5 ACCEPTED SOLUTIONS

Accepted Solutions
Drrickryp
Super User II
Super User II

@Canadiansal 

Put the form on the screen below the gallery.  No need for a Navigate() function in any of your commands.  In the gallery, make the Template fill property If(ThisItem.IsSelected,LightBlue,RGBA(0, 0, 0, 0)).  Put the SubmitForm(Form1) button on the screen. You want to set the form's Default mode to Edit.  You might also want to put a "+" icon outside the gallery to add a new record.  It should have NewForm(Form1) as its OnSelect property.

View solution in original post

@Canadiansal 

The Item property of the form should be Gallery1.Selected  It will automatically fill when you select an item in the gallery; assuming Gallery1 is the name of your gallery.  The ">" icon is unnecessary.

View solution in original post

gabibalaban
Super User II
Super User II

Hi @Canadiansal,

As you said at begining, the left Form is actually a Gallery, right ?

There is no problem to move the Form (the right Form 🙂 ) on the Main Screen along with the submit Button. Don't forget to modify the OnSelect property of the button: 

SubmitForm(Form1);Navigate(MainScreen,ScreenTransition.Fade)

If you want to track the edited records, update the Form OnSuccess property with: Collect(editedRecords,Form1.LastSubmit.ID)

Then Insert a label in your gallery with:

Text: "Already modified"

Visible: ThisItem.ID in editedRecord.Value

And you'll see the records already modified in this session.

 

Hope it helps ! 

  

View solution in original post

joeinmay
Resolver II
Resolver II

I would like to put the Form on the EditScreen on the Main screen - so the Application will have only 1 Screen, with 2 Forms. How do I get this to work?

Yes just like what you have in your image.
Select everything on the right (form) and group them.
From the gallery on the Right Arrow OnSubmit property:
Set(showEditform,"show"); Set(varID,ThisItem.ID)
Now go back to the right side group (which has the form etc.)
Set the visible property of the group: If(showEditform="show",true,false)
Next on the Form Item property: LookUp(?Source?,ID=varID)
Submit Button on Select property: SubmitForm(?form?); Refresh(?Source?); Set(showEditform,"hide")

Additionally, since there will be about 10 records in the Left form - is there a way that the users can know which record they have already edited?

Ok so everytime when the right arrow is clicked to show the edit form.
You can include onselect property for the arrow :Collect(tempCollection,{AllID: ThisItem.ID})
Next insert an icon as an indicator to change color green vs black to check if the current ID is listed in the tempCollection. If(LookUp(tempCollection,AllID=ThisItem.ID),AllID=ThisItem.ID,Green,Black)

note: The above is for the current session only.

 

OR, can they edit the records directly in the left Form - without having to launch a second form?

This can be done two ways:
Edit and save (patch) single row
or Edit all rows (Gallery.allitems) and save (patch)

View solution in original post

Drrickryp
Super User II
Super User II

_1.pngHi @Canadiansal 

I have no idea what these other commenters are talking about, so I'll ignore them.  The button to submit the form should not be inside the form or inside the gallery.  The datasource of the form should be the same as the datasource of the gallery. The OnSelect property of the button should have the name of the form to submit.  Check the name of the form and make sure it is the same as the one you are submitting.   This is not a complicated process, stay focused.  The picture shows my Contacts list.  The Form named Form1, is directly below it.  The Items property of the gallery is the same as the datasource of the form.  The Item property of the form is Gallery1.Selected. The button's OnSelect property is SubmitForm(Form1).  The "+" icon above the gallery has its OnSelect property NewForm(Form1).  I assure you that it works perfectly when I tested it. 

View solution in original post

12 REPLIES 12
Drrickryp
Super User II
Super User II

@Canadiansal 

Put the form on the screen below the gallery.  No need for a Navigate() function in any of your commands.  In the gallery, make the Template fill property If(ThisItem.IsSelected,LightBlue,RGBA(0, 0, 0, 0)).  Put the SubmitForm(Form1) button on the screen. You want to set the form's Default mode to Edit.  You might also want to put a "+" icon outside the gallery to add a new record.  It should have NewForm(Form1) as its OnSelect property.

View solution in original post

Canadiansal
Helper V
Helper V

So how do I trigger the selection? Currently, I have the Navigate triggered onSelect.

Canadiansal_0-1611242145886.png

 

@Canadiansal 

The Item property of the form should be Gallery1.Selected  It will automatically fill when you select an item in the gallery; assuming Gallery1 is the name of your gallery.  The ">" icon is unnecessary.

View solution in original post

gabibalaban
Super User II
Super User II

Hi @Canadiansal,

As you said at begining, the left Form is actually a Gallery, right ?

There is no problem to move the Form (the right Form 🙂 ) on the Main Screen along with the submit Button. Don't forget to modify the OnSelect property of the button: 

SubmitForm(Form1);Navigate(MainScreen,ScreenTransition.Fade)

If you want to track the edited records, update the Form OnSuccess property with: Collect(editedRecords,Form1.LastSubmit.ID)

Then Insert a label in your gallery with:

Text: "Already modified"

Visible: ThisItem.ID in editedRecord.Value

And you'll see the records already modified in this session.

 

Hope it helps ! 

  

View solution in original post

Canadiansal
Helper V
Helper V

This has been helpful - thank you all.

So I have Set this up and the Selection etc is working.

My Issue is that the Submit Button is not writing to the datasource. Does it need to be out of the Form or in?

The Code is: SubmitForm(MainForm)

(I named the Form "Main Form")

My previous arrangement of having a second screen +second Form (Form1) has this on the Submit Button:

SubmitForm(Form1);Navigate(MainScreen,ScreenTransition.Fade)

And this writes to the data source and works as expected. What could I be missing? 

Canadiansal_0-1611243930832.png

 

joeinmay
Resolver II
Resolver II

I would like to put the Form on the EditScreen on the Main screen - so the Application will have only 1 Screen, with 2 Forms. How do I get this to work?

Yes just like what you have in your image.
Select everything on the right (form) and group them.
From the gallery on the Right Arrow OnSubmit property:
Set(showEditform,"show"); Set(varID,ThisItem.ID)
Now go back to the right side group (which has the form etc.)
Set the visible property of the group: If(showEditform="show",true,false)
Next on the Form Item property: LookUp(?Source?,ID=varID)
Submit Button on Select property: SubmitForm(?form?); Refresh(?Source?); Set(showEditform,"hide")

Additionally, since there will be about 10 records in the Left form - is there a way that the users can know which record they have already edited?

Ok so everytime when the right arrow is clicked to show the edit form.
You can include onselect property for the arrow :Collect(tempCollection,{AllID: ThisItem.ID})
Next insert an icon as an indicator to change color green vs black to check if the current ID is listed in the tempCollection. If(LookUp(tempCollection,AllID=ThisItem.ID),AllID=ThisItem.ID,Green,Black)

note: The above is for the current session only.

 

OR, can they edit the records directly in the left Form - without having to launch a second form?

This can be done two ways:
Edit and save (patch) single row
or Edit all rows (Gallery.allitems) and save (patch)

View solution in original post

Drrickryp
Super User II
Super User II

_1.pngHi @Canadiansal 

I have no idea what these other commenters are talking about, so I'll ignore them.  The button to submit the form should not be inside the form or inside the gallery.  The datasource of the form should be the same as the datasource of the gallery. The OnSelect property of the button should have the name of the form to submit.  Check the name of the form and make sure it is the same as the one you are submitting.   This is not a complicated process, stay focused.  The picture shows my Contacts list.  The Form named Form1, is directly below it.  The Items property of the gallery is the same as the datasource of the form.  The Item property of the form is Gallery1.Selected. The button's OnSelect property is SubmitForm(Form1).  The "+" icon above the gallery has its OnSelect property NewForm(Form1).  I assure you that it works perfectly when I tested it. 

View solution in original post

Canadiansal
Helper V
Helper V

This seems very straightforward - yet, I am running into an issue. The Submit button is not writing to the database. I have copied the same code from my second screen(Which I plan to delete). The Second Screen works as expected and writes to the database. Any ideas where I might be missing a setting?

Canadiansal_0-1611254827501.png

 

Second Screen works as expected:

Canadiansal_1-1611254904315.png

 

Canadiansal
Helper V
Helper V

So I got it to work, but its editing the record, not adding a new one. I would like to keep the original record and create a copy when the user hits submit.

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

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 the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (25,265)