cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Patch issues combobox

Hi Powerapps Cimmunity,

 

i have a submit button that is patching some data back to a sql table like this - ForAll(ComboBox1_1.SelectedItems, Patch('SOURCE', Defaults('SOURCE'),{Data_Integrity_Test_Case_Id:EditForm1.LastSubmit.Test_Case_ID, Data_Integrity_Systems_Id:ID})). i have a combobox where i am grabbing the data for Data_Integrity_Systems_Id. both columns are int type, the patch works perfectly fine when i am patching in the edit screen , but when im creating a new form. the EditForm1.LastSubmit.Test_Case_ID wont work and wont product a value and since the table doesnt allow nulls it wont at all. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Patch issues combobox

Hi @Shafeel_07,

Based on the formula that you provided, I think you have some misunderstanding in EditForm1.LastSubmit.Test_Case_ID formula.

The EditForm1.LastSubmit.Test_Case_ID formula would return value only when you save your form data into your SQL Table using SubmitForm function.

When you open a new form in your app (in New Form), the Edit form would be reset, so the EditForm1.LastSubmit.Test_Case_ID formula would return blank. In addition, the Data_Integrity_Test_Case_Id column value would be generated only when you save a record into your SQL table.

In other words, you could not get the Data_Integrity_Test_Case_Id value of the record which has not been added into your SQL table using EditForm1.LastSubmit.Test_Case_ID formula.

As an alternative solution, I have made a test on my side, please take a try with the following workaround:

ForAll(
         ComboBox1_1.SelectedItems, 
         Patch('SOURCE', Defaults('SOURCE'),{Data_Integrity_Systems_Id:ID})   /* <-- Don't provide a value for Data_Integrity_Test_Case_Id column */
    )

Note: We could not provide a value for a Auto-Generated column in SQL Table data source within PowerApps.

If you want to assign a value for a Auto-Generated column in a SQL table from PowerApps app, I afraid that there is no way to achieve your needs currently.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Power Apps
Power Apps

Re: Patch issues combobox

Hi @Shafeel_07,

I've formatted your formula for understanding:

ForAll(ComboBox1_1.SelectedItems, 
    Patch('SOURCE', Defaults('SOURCE'),
        {
            Data_Integrity_Test_Case_Id: EditForm1.LastSubmit.Test_Case_ID, 
            Data_Integrity_Systems_Id: ID
        }
    )
)

If I understand correctly, EditForm1.LastSubmit.Test_Case_ID is not showing up for you when creating a new form.

 

To clarify, the LastSubmit property of a form will only have a record if you use SubmitForm. It is possible to reset the last submitted record, so you may want to set it to a variable upon successfully using SubmitForm.

 

For example, in the OnSuccess property of EditForm1, you could set it to:

Set(selectedRecord, EditForm1.LastSubmit)

But I'll need more details on what exactly you're trying to achieve here to guide more.

Highlighted
Helper I
Helper I

Re: Patch issues combobox

So i have a ComboBox where i am able to select multiple values from a list and return its ID which goes into  Data_Integrity_Systems_Id: ID , and then Data_Integrity_Test_Case_Id grabs the test case id of the value seleceted from the gallery, it works fine when you select a value from the gallery but not when you create a new test case.  i have a auto id generator in Sql which creates a new Data_Integrity_Test_Case_Id. with EditForm1.LastSubmit.Test_Case_ID i am trying to retrieve the last Test_Case_ID submitted

Highlighted
Power Apps
Power Apps

Re: Patch issues combobox

Can you draw out the sequence of actions you're expecting in your app?

Highlighted
Helper I
Helper I

Re: Patch issues combobox

So i have a 1 to many relationship where one Data_Integrity_Test_Case_Id can belong to many  Data_Integrity_Systems_Id which is where i use the ComboBox to retireve multiple values, then i would store this in a table like given in the attachment, i have a gallery where i can retrieve Data_Integrity_Test_Case_Id but when im creating a new form it wont work because the Data_Integrity_Test_Case_Id is automatically generated by sql

Highlighted
Helper I
Helper I

Re: Patch issues combobox

even if i have a timer and put my patch statement there to allow the Data_Integrity_Test_Case_Id  to be generated in my sql table , it still wont retrieve the last submitting Data_Integrity_Test_Case_Id 

Highlighted
Community Support
Community Support

Re: Patch issues combobox

Hi @Shafeel_07,

Based on the formula that you provided, I think you have some misunderstanding in EditForm1.LastSubmit.Test_Case_ID formula.

The EditForm1.LastSubmit.Test_Case_ID formula would return value only when you save your form data into your SQL Table using SubmitForm function.

When you open a new form in your app (in New Form), the Edit form would be reset, so the EditForm1.LastSubmit.Test_Case_ID formula would return blank. In addition, the Data_Integrity_Test_Case_Id column value would be generated only when you save a record into your SQL table.

In other words, you could not get the Data_Integrity_Test_Case_Id value of the record which has not been added into your SQL table using EditForm1.LastSubmit.Test_Case_ID formula.

As an alternative solution, I have made a test on my side, please take a try with the following workaround:

ForAll(
         ComboBox1_1.SelectedItems, 
         Patch('SOURCE', Defaults('SOURCE'),{Data_Integrity_Systems_Id:ID})   /* <-- Don't provide a value for Data_Integrity_Test_Case_Id column */
    )

Note: We could not provide a value for a Auto-Generated column in SQL Table data source within PowerApps.

If you want to assign a value for a Auto-Generated column in a SQL table from PowerApps app, I afraid that there is no way to achieve your needs currently.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Helper I
Helper I

Re: Patch issues combobox

i would still need Data_Integrity_Test_Case_ID to be patched, so thanks for the reply, i will have to find some other alternative 

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,900)