Hi,
I am trying to create an overtime requesting app.
I am running into an issue when using Patch to create a database or history of the OT requests. Here is my code:
the error I get is for "Invalid argument type" . The Supervisor, Hours, and Billable fields are drop down menus. The Customer Approval and Reason are TextInput. For the FSE I am trying to grab it from the user log in credential.
Patch(Table1, Defaults(Table1),
{ Supervisor: DataCardValue9_3.Selected.Value,
FSE: User().FullName,
Hours: DataCardValue9_2.Selected.Value,
Billable: DataCardValue9_4.Selected.Value,
CustomerApprovalBy: TextInput2_2.Text,
Reason: TextInput2_1.Text
}
)
Thank you so much for the help!!
Solved! Go to Solution.
HI @Jgarza ,
It will be Supervisor - put it back the way you had it originally. For Numeric columns (example)
Hours: Value(DataCardValue9_2.Selected.Value)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @Jgarza ,
Are any of those fields Numeric - if (for example) Hours
Patch(
Table1,
Defaults(Table1),
{
Supervisor: DataCardValue9_3.Selected.Value,
FSE: User().FullName,
Hours: Value(DataCardValue9_2.Selected.Value),
Billable: DataCardValue9_4.Selected.Value,
CustomerApprovalBy: TextInput2_2.Text,
Reason: TextInput2_1.Text
}
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi,
I think we would need some more info to be sure, but here is a guess. Make sure that the data type you are passing is the same as in the Excel file. If you designate a column in your table as a number, using cell formatting, then you need to make sure that you pass a number in your patch. It might be that you are passing a string.
If you need a number, you would use the Value function, e.q. Hours: Value(DataCardValue9_2.Selected.Value),
Does the error show any more information? If you have changed the cell formatting, also make sure to refresh the data connection in the app. Took me some time to remember that when trying this out. 🙂
Best,
Paul
Ah, didn't refresh my page, so I missed Warren's answer which is the same idea, and I can't seem to delete my reply.
Hi Warren,
that was a great point! thanks a lot for that!
Now I am getting another error calling for "Expected type Text. Found type Record." in my Billable column. I am sorry these might be easy questions but I am just diving into powerapps. 😥
I adjusted the code to this after finding that only my hours should be numeric and everything else should be text:
Patch(Table1, Defaults(Table1),
{
Supervisor: DataCardValue9_3.SelectedText,
FSE: User().FullName,
Hours: DataCardValue9_2.Selected.Value,
Billable: DataCardValue9_4.SelectedText,
CustomerApprovalBy: TextInput2_2.Text,
Reason: TextInput2_1.Text
}
)
Thanks!
Thanks Paul!
You both were right! some of my columns were set to numeric instead of text. Now I am getting a different error calling for Expected Type Record. No idea how to change this to Text.
I adjusted the code to this after finding that only my hours should be numeric and everything else should be text:
Patch(Table1, Defaults(Table1),
{
Supervisor: DataCardValue9_3.SelectedText,
FSE: User().FullName,
Hours: DataCardValue9_2.Selected.Value,
Billable: DataCardValue9_4.SelectedText,
CustomerApprovalBy: TextInput2_2.Text,
Reason: TextInput2_1.Text
}
)
Thanks!
HI @Jgarza ,
It will be Supervisor - put it back the way you had it originally. For Numeric columns (example)
Hours: Value(DataCardValue9_2.Selected.Value)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Thank you so much Warren!
Thanks everyone for helping out! App works like a charm!! simple case of using "&" instead of ";"
I'll start studying power apps more!
User | Count |
---|---|
159 | |
86 | |
68 | |
63 | |
62 |
User | Count |
---|---|
209 | |
150 | |
93 | |
81 | |
68 |