cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AW
Level: Powered On

Save data from multiple screens to submit

How can I save data from fields across multiple screens to submit as one entry? For example, I can use an Edit Screen to submit a form with 5 fields. I'd rather have a flow with detailed explanations so each field (or two) is on separate screens. I can create a button to the next screen, but how do I save the data from each field/screen and submit all fields at once? Or (and on a related note), if I have to submit each field at at time, how do I append the data to the same record?

21 REPLIES 21
PowerApps Staff murali
PowerApps Staff

Re: Save data from multiple screens to submit

If I understand your scenario right, you have an item that you want to edit but the details are on multiple screens.

 

Here is a suggestion

1. Create a form for each screen that contains information about the edited item e.g. Form1, Form2 and Form3. Form1 can contain information about Field1 and Field2, Form2 about Field3 and Field4, Form3 about Field5 and Field6.

2. On the last screen where you have a button to submit the changes, you can do something like

Patch(DataSource, Item_Being_Edited, Form1.Updates, Form2.Updates, Form3.Updates).

 

Form.Updates collects all the updates from the form

 

I assumed you have the item you want to edit. This is what you bind to Item property of each of these forms.

DataSource is the datasource you are working with. This is what you bind to DataSource property of each of these forms.

 

Let us know if this helps

 

Murali

wingers1290
Level: Powered On

Re: Save data from multiple screens to submit

Thank you for this answer! I had the same problem and implemented the Patch command to resolve this issue.

 

I am now wondering how I can extend this to apply for creating a new record?

 

I can only see how to use this for editing, since I can pass the Item_Being_Edited into the command... Not sure what my item would be if this was a new item.

 

Thanks!

Meneghino
Level 10

Re: Save data from multiple screens to submit

Hi @wingers1290

To create a new item with a patch, use Patch( MyDataSource, Defaults(MyDataSource), {...new record... }) as described here:

 

https://powerapps.microsoft.com/en-us/tutorials/function-patch/

 

and here

 

https://powerapps.microsoft.com/en-us/tutorials/function-defaults/

wingers1290
Level: Powered On

Re: Save data from multiple screens to submit

Thanks!

 

Is it possible to detect whether a given form is in edit mode or new mode, and then either inject the model or the Default([table]) command into Patch()?

 

At the momemt I'm having to use two different navigations with two seperate forms, would be great to combine them.

Meneghino
Level 10

Re: Save data from multiple screens to submit

hi @wingers1290

 

I am not sure since I normally don't use forms but simply create the needed controls (text inputs, date pickers etc.) on a screen and then create the save, cancel, new, delete etc. buttons.  It is little a bit more work at the beginning but then you can control the business logic much better.

 

This way you can also have just one form and use it for both new and edit.

 

If this is something that you are interested in, I can try to help you with specific issues.

PowerApps Staff SpencerLynn
PowerApps Staff

Re: Save data from multiple screens to submit

Hi!

 

You can read the form's mode using it's Mode property. The conditional part of the formula could look like the following:

 

If(<FormControl>.Mode = FormControl.Edit, <EditItem>, <NewItem>)

Thanks,

Spencer

Highlighted
ColinI
Level: Powered On

Re: Save data from multiple screens to submit

Meneghino,

 

I'm another PowerApps newbie, but when you say you "create the needed controls ... on a screen and then create the save, cancel, new, delete etc. buttons", this sounds like PRECISELY the manner that I would like to approach the introduction, dissemination and development of PowerApps at our company.  Can you elaborate exactly how you do that WITHOUT using forms?  I can see using the Patch function (with "Form.Updates") instead of SubmitForm, EditForm, etc., but I don't see how you can avoid forms altogether.  I would be VERY eager to learn how you accomplish that!

Meneghino
Level 10

Re: Save data from multiple screens to submit

Hi @ColinI

Here is a basic example.  Let's assume that you have a data source (MyDataSource) that has at least one text column (MyTextColumn).  Here is how you would create a new record in that data source.

 

1) Create a new blank app

2) Connect MyDataSource

3) Create a text input control (TextInput1)

4) Create a button an set its OnSelect property to:

Patch(MyDataSource, Defaults(MyDataSource), {MyTextColumn: TextInput1.Text})

Please let me know how you get on

ColinI
Level: Powered On

Re: Save data from multiple screens to submit

Ah.  Thanks for your prompt and clear response Meneghino!  Indeed, I am familiar with the methodology you describe.  It seems that it would make for a very long Patch string if there were many input fields and could get rather unwieldly as if gets larger (is there a character limit on the lenght of a PowerApps function call?).  I guess I was hoping that there would a way to use something like the Form.Updates syntax of the Patch command in a very consise function call that would reference a batch of previously MANUALLY created controls (possibly set up by a SME without much technical knowledge or experience--or even access--using the eventual production data source).  My idea is that the assignment of the responsibility of the design and much of the creation of the "front-end" interface could be separated from the more "back-end" responsibility for setup of data-source interconnections and the more advanced functionalities.  Perhaps it is possible that the "front-end" creation could be "seeded" with a basic pre-configured base template (perhaps consisting of page(s) of forms that the designer could use as a launch platform)?  Does this idea make any sense?  Is it practical in the current version of PowerApps, or if not, is there anything in its development Roadmap that could make it a feasible strategy in the near future?

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,055)