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

Patch UnknownError - Excel -> OneDrive

Hi,
I have an unknown error, the error does not alter any functionality and evrything works as i expect it to.
But i should have an app without errors i guess, so here is what i know.

The "ID" field in Excel is set to Number (Integer).
The "ID" field in the PowerApp is set to a number also. (Properties -> Format -> Number)

When i submit my form SubmitForm([@FormNewReceipt]); all data is saved and returned to the gallery listing all current data in the excel DB.
When i go to the OnSuccess of the Form i have the unknow error with the code below.
OnSuccess:
Patch(
    RECEIPT_DB,
    Defaults(RECEIPT_DB),
    {
        'ID': Max(
        RECEIPT_DB,
        ID),
        'Date': CurrentDateTime,
        'User': User.Text,
        'Reason': ReasonInput.Text,
        'Client': ClientInput.Text,
        'Project': ProjectInput.Text,
        'Note': NotesInput.Text
    }
);


When i check the Excel only the columns that have "ID" have been changed from Number to General Format.


The above Patch is submitted along with the following "codeless" code to a differetn table.
Capture.JPG

final actions in the OnSuccess are:
Navigate(
    DashboardScreen,
    ScreenTransition.Fade
);
ResetForm(FormNewReceipt);
Any food for thought on solving this issue would be greatly appreciated.

Thanks

3 REPLIES 3
Community Support Team
Community Support Team

Re: Patch UnknownError - Excel -> OneDrive

Hi @Rory ,

Do you want to update table2 when you update table1 successfully?

If so, you use the data in the form to update table2 according to your formula.

The property of OnSucces means that "How an app responds when a data operation has been successful".

So, the action's order is that : firstly update table1 successfully and then update table2 with the same data in the form.

However, the data in the form will be invalid when the form is submitted successfully.

That's the reason why you can't update table2.

If you want to use the data in the form after the form being submitted, I suggest you save the data as variable before the form is submitted.

For example,set the submit button's OnSelect:

Set(a,CurrentDateTime);Set(b,User.Text);Set(c,ReasonInput.Text);Set(d,ClientInput.Text);Set(e,ProjectInput.Text);
Set(f,
NotesInput.Text);SubmitForm(Form1)

Set the form's OnSuccess:

Patch(
    RECEIPT_DB,
    Defaults(RECEIPT_DB),
    {
        'ID': Max(
        RECEIPT_DB,
        ID),
        'Date': a,
        'User': b,
        'Reason': c,
        'Client': d,
        'Project':e,
        'Note': f
    }
);

Best regards,

Community Support Team _ Phoebe Liu

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Rory
Level: Powered On

Re: Patch UnknownError - Excel -> OneDrive

Thanks for the suggested solution @v-yutliu-msft ,

I like this solution as its better written code. thank-you!
Everything functions well, but i still recieve an unknown error.
I'm unsure how to handle the unknown, so maybe i will leave it for now and see fi it does the magic microsoft fix itself thing.

Thanks again for your help i really appreciate it!

Rory
Level: Powered On

Re: Patch UnknownError - Excel -> OneDrive

@v-yutliu-msft 

after using your suggestion successfully I played around with it and rater than set all the variables I kept them the same as they are above and just set a boolean.
After the form1 submit,  the set boolean variable becomes true and onSuccess is then patched.

I still have an unknown error, All I know is that the Number column for ID in the excel spread sheet keeps being changed from Number to General after successful submit and patch. I need it to stay as a Number.
So maybe there is some code or function changing the column value format in Excel. It would be better if it just threw an error rather than accepting the submit changing the structure of the  data.
In conclusion as of 02/08/2019 all of the above solutions are functional. Even with the unknown error the app continues to function correctly consecutivley.

save button - OnSelect =
SubmitForm(FormNewReceipt);
ResetForm(FormNewReceipt);
Set(formSubmit2, true);

FormNewReceipt - OnSuccess =
If(formSubmit2,
Patch(
    RECEIPT_DB,
    Defaults(RECEIPT_DB),
    {
        'ID': Max(RECEIPT_DB, ID) + 1,
        'Date': CurrentDateTime,
        'User': User.Text,
        'Reason': ReasonInput.Text,
        'Client': ClientInput.Text,
        'Project': ProjectInput.Text,
        'Note': NotesInput.Text
    }
));

 

 

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,447)