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

How to submit multiple forms at once

Hey guys,

 

I have the following code in a button's OnSelect:

 

SubmissionDataCard.DataField = "flows Contact List"; If ('Staff.Edison.Checkbox'.Value, SubmitForm(Form1)); ResetForm(Form1);
SubmissionDataCard.DataField = "flows Test Contact List"; If ('Staff.ParkPlace.Checkbox'.Value, SubmitForm(Form1)); ResetForm(Form1); 
SubmissionDataCard.DataField = "flows Test Contact List 2"; If ('Staff.Plymouth.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1)

 

It changes the data line, and if a matching checkbox is ticked off it will submit the form with the new data. It should do this until the end at 'NewForm', but it stops after 'ResetForm(Form1)' in the first line and I can't figure out why. PowerApps does not give me any errors either.

 

Is there anything I can do to get this to work?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Thank you both SO MUCH for the help! It was a combination of both posts that helped me so I don't know which to accept as a solution. Here is the code that does what I need it to.

 

UpdateContext({DefaultText: MessageBox}); 
UpdateContext({CurrentList: "flows Contact List"}); If ('Staff.Edison.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');  
UpdateContext({CurrentList: "flows Test Contact List"}); If ('Staff.ParkPlace.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');  
UpdateContext({CurrentList: "flows Test Contact List 2"}); If ('Staff.Plymouth.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');

I'm beginning to understand this a lot more now. I added in Refresh Data to act as a pause that gives it enough time between data submissions.

 

Thank you both.

View solution in original post

3 REPLIES 3
Community Champion
Community Champion

Hi @ChrisC

 

I am not sure what you mean by "It changes the data line".  Are you referring to this?

SubmissionDataCard.DataField = "flows Contact List

In PowerApps this is just either true or false, it is not a statement by which you assign a value.

 

Since this series of statements is an action (OnSelect) then true or false just do not do anything.

 

I am not a big expert on forms since I avoid them, preferring just to Patch changes to data, so I am not sure how to futher help you.

 

Power Apps
Power Apps

@ChrisC - PowerApps is based on a declarative dataflow language. It's different from imperative languages where you tell objects what to do. In PowerApps, you declare what data flows into control properties and dataflow takes care of the rest for you.

 

With that said, '=' is an equality check operator and not an assignment operator. It's not going to assign "flows Contact List" to SubmissionDataCard.DataField. In order to achieve what you want, you could set the value via a context variable or a collection and have that flow into SubmissionDataCard.DataField

 

e.g. SubmissionDataCard.DataField = CtxtVar1

Button.OnSelect = UpdateContext({CtxtVar1: "flows Contact List"});If ('Staff.Edison.Checkbox'.Value, SubmitForm(Form1)); ResetForm(Form1); and so on

 

Hope that helps.

 

Thanks

Murali

Thank you both SO MUCH for the help! It was a combination of both posts that helped me so I don't know which to accept as a solution. Here is the code that does what I need it to.

 

UpdateContext({DefaultText: MessageBox}); 
UpdateContext({CurrentList: "flows Contact List"}); If ('Staff.Edison.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');  
UpdateContext({CurrentList: "flows Test Contact List"}); If ('Staff.ParkPlace.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');  
UpdateContext({CurrentList: "flows Test Contact List 2"}); If ('Staff.Plymouth.Checkbox'.Value, SubmitForm(Form1)); NewForm(Form1); Refresh('Message List');

I'm beginning to understand this a lot more now. I added in Refresh Data to act as a pause that gives it enough time between data submissions.

 

Thank you both.

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (11,335)