Hi all,
I made the same app as the link below and everything worked fine untill I wanted to patch my data. The patch functions gives an error called "Invalid argument type (Table), Expecting a Record value instead. How can I solve this?
Power Apps Editable Table/Gallery like Excel (Tutorial) - YouTube
App OnStart I have:
ClearCollect(colTaskUpdates,
Defaults('Customer VAT')
;
Clear(colTaskUpdates)
)
In a gallery variable I have OnSelect:
If(
ThisItem.'Customer VAT ID' in colTaskUpdates.cr99c_customervatid,
Update(
colTaskUpdates,
LookUp(
colTaskUpdates,
cr99c_customervatid = ThisItem.'Customer VAT ID'
),
{
cr99c_customervatid: ThisItem.'Customer VAT ID',
cr99c_invoicenumber: InvoiceNumber_1.Text,
cr99c_nettinvoiceamount: NettInvoiceAmount_1.Text,
cr99c_vatamount: VATAmount_1.Text,
cr99c_invoicedate: InvoiceDate_1.Text,
cr99c_buyer: Buyer_1.Text,
cr99c_countrycodebuyer: CountryCodeBuyer_1.Text,
cr99c_vatidnumberbuyer: VATIDNumberBuyer_1.Text
}
),
Collect(
colTaskUpdates,
{
cr99c_customervatid: ThisItem.'Customer VAT ID',
cr99c_invoicenumber: InvoiceNumber_1.Text,
cr99c_nettinvoiceamount: NettInvoiceAmount_1.Text,
cr99c_vatamount: VATAmount_1.Text,
cr99c_invoicedate: InvoiceDate_1.Text,
cr99c_buyer: Buyer_1.Text,
cr99c_countrycodebuyer: CountryCodeBuyer_1.Text,
cr99c_vatidnumberbuyer: VATIDNumberBuyer_1.Text
}
)
)
The save button OnSelect has
If(
CountRows(colTaskUpdates) > 0,
Patch(
'Customer VAT ID',
colTaskUpdates
);
Notify(
"Succees",
NotificationType.Succees
)
);
Clear(colTaskUpdates)
In dataverse the data types of the following variables are:
cr99c_customervatid: Unique Identifier
cr99c_invoicenumber: Text
cr99c_nettinvoiceamount: Currency
cr99c_vatamount: Currency
cr99c_invoicedate: Date Only
cr99c_buyer: Text
cr99c_countrycodebuyer: Text
cr99c_vatidnumberbuyer: Text
Hi @Digdem ,
You could try:
If(
CountRows(colTaskUpdates) > 0,
Collect(
'Customer VAT ID',
colTaskUpdates
);
Notify(
"Succees",
NotificationType.Succees
)
);
Clear(colTaskUpdates)
Best Regards,
Bof
Hi @v-bofeng-msft ,
Thank you so much for your help. I changed my formula and the error messages are gone, however the data in dataverse is not changed.
When I make changes in my gallery this is saved in my collection and when I click on "save" button the collection items should overwrite existing items in dataverse. This is currenty not the case. Do you know how to solve this?
Hi @Digdem ,
Overall your code looks good to me. My main concern is how you are populating some of the fields, maybe I am wrong but don't you need to convert? Example your date field, wouldn't you need to populate the date field with a Date (https://docs.microsoft.com/en-us/power-apps/maker/canvas-apps/functions/function-datevalue-timevalue) and for your currency something like:
Currency:Value(TextInput2.Text)
Sorry, don't do a ton with Canvas apps but this is what jumped out to me.
Hi @Digdem, this you get this working afterall? By "should overwrite existing items in dataverse" do you mean the items can created instead of updating. To update you can use Patch function and if you're using a form, try SubmitForm function to create/update. Hope this helps!
I mean the items can update.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
15 | |
11 | |
8 | |
5 | |
4 |
User | Count |
---|---|
22 | |
16 | |
13 | |
12 | |
12 |