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!
Solved! Go to Solution.
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.
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.
@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.
Stay up tp date on the latest blogs and activities in the community News & Announcements.
Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST
Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.
User | Count |
---|---|
203 | |
184 | |
71 | |
43 | |
33 |
User | Count |
---|---|
336 | |
265 | |
116 | |
66 | |
66 |