I have a PowerApp with a SP List behind it, but also 10 fields that pull from a Azure SQL Database.
When a user clicks the "+" button to create a new record, they type in an invoice number, search the SQL DB to find it, and once found, this pulls in the other 9 fields from the SQL Database. On the Datacard for each of these fields, under "Default" I have a formula that reflects the selected invoice number and the column - in this sample it is the invoice number: selectedInvoice.Invoice_x0020_Number
All 10 fields have the default value set as the "selectedInvoice"."SQLColumn"
When the Form is submitted, the values all save back to the SP list, which is as desired.
However, when I then go to add another record, the 10 "default" SQL values are already populated, which I don't want, I want a true reset Form.
On the Submit icon under OnSelect I have: SubmitForm(Form1);ResetForm(Form1)
On the "+" icon for adding a new record on OnSelect, I have: NewForm(Form1);Navigate(InputScreen)
No matter what I am trying, I can't seem to get the NewForm without those 10 default SQL values.
Anyone have any ideas?
Solved! Go to Solution.
I was able to reset the Form with the help of a few PowerApps gurus. In the OnSelect, set this:
SubmitForm(Form1);
Set(
selectedInvoice,
Blank()
);
ResetForm(Form1);
Hi @DS2 ,
Did you mean that you want to create records for SharePoint list, but you want to use the data from Azure SQL database?
Usually, the Default property of data cards inside edit form is:
ThisItem.SharePointListColumnName
But in your case, you said that you are using "selectedInvoice.Invoice_x0020_Number". Which one is the data source of this Form control? One Form can only have one data source, and using SubmitForm will only update record to this data card. You cannot have Azure SQL database set as the data source of Form control, then use SubmitForm control to update data to SharePoint list.
Sorry but I didn't fully understand what you mean by "default value set as the "selectedInvoice"."SQLColumn". When the Form is submitted, the values all save back to the SP list"? If Default property is set to SQL column, then even if you reset the Form control, it should still be reset back to Default property which is SQL column.
Please help to explain more details about this app, maybe with some sample data of the related data sources. Some screenshots would be even better.
Do mask sensitive data before uploading.
Regards,
Mona
Thank you @v-monli-msft ! Here is how the App works:
I was able to reset the Form with the help of a few PowerApps gurus. In the OnSelect, set this:
SubmitForm(Form1);
Set(
selectedInvoice,
Blank()
);
ResetForm(Form1);
User | Count |
---|---|
141 | |
140 | |
76 | |
73 | |
71 |
User | Count |
---|---|
230 | |
170 | |
74 | |
69 | |
60 |