Hi all!
I'm running into a problem with trying to update multiple columns in a record in one of my custom tables. My problem primarily involves 2 screens in my app.
Screen 1:
On screen 1 I have a gallery of existing records in my custom table. I click on a record in my custom table that I want to edit, and this sets a variable (varGUID) to the GUID of the record I have selected. This takes me to screen 2.
Screen 2:
On screen 2 I have an edit form full of all the columns in my custom entity with the Item set to a LookUp of the record I clicked on in the previous screen. Basically, I have all the data for the record I clicked on and the ability to edit all that record’s columns. The Item category for the edit form is like so:
LookUp([@'Custom Table'], 'Custom Table GUID' = varGUID)
In my custom table are multiple columns of differing data types. Specifically, there are multiple Text and Whole Number data type columns. Let's say that 'Column Text 1' and 'Column Text 2' are text type, and 'Column Num 1' and 'Column Num 2' are number type. The card values on the edit form for 'Column Text 1' and 'Column Text 2' are Text1CardValue and Text2CardValue respectively, while the card values for 'Column Num 1' and 'Column Num 2' are Num1CardValue and Num2CardValue respectively.
On screen 2 I have a save button to submit the changes to the columns in my custom table that I make. These changes are submitted through a patch like the one below:
Patch( [@'Custom Table'],
LookUp([@'Custom Table'], 'Custom Table GUID' = varGUID),
{
‘Column Text 1’: Text1CardValue.Text,
‘Column Text 2’: Text2CardValue.Text,
'Column Num 1': Value(Num1CardValue.Text),
'Column Num 2': Value(Num2CardValue.Text),
}
The problem is this only works if I have a value already saved in Microsoft Dataverse for ‘Column Num 1’ and ‘Column Num 2’, or you are patching in a value to BOTH of the number columns. So, if either ‘Column Num 1’ or ‘Column Num 2’ have no value already stored in Microsoft Dataverse and I am not patching in a value (ie. Num1CardValue or Num2CardValue are empty at the time of patching) then PowerApps will not update ANY of the columns values. If there are number values (even 0) stored in both ‘Column Num 1’ and ‘Column Num 2’ or the number columns are being patched with a number, then the patch executes perfectly and all column values (text and number type) are updated.
To further clarify, the example below would fail:
'Column Text 1' is currently null and is being patched with the value “Text 1”
'Column Text 2' is currently null and is being patched with the value “Text 2”
'Column Num 1' is currently null and is being patched with the value “123”
'Column Num 1' is currently null and is NOT being patched with anything (remaining null)
In the above scenario, the patch would NOT execute for ANY of the columns. All columns would remain null.
This issue is weird to me because the problem only comes from number type columns, not text type. The following example would actually succeed for all columns:
'Column Text 1' is currently null and is being patched with the value “Text 1”
'Column Text 2' is currently null and is NOT being patched with anything (remaining null)
'Column Num 1' is currently null and is being patched with the value “123”
'Column Num 1' is currently null and is being patched with the value “456”
I know this is long winded, but I’d really appreciate any help I can get. So far I have not found any way around this. If I want to patch all my columns I have to put in 0 for the number columns even when I’d prefer to leave them null.
Thanks to anyone who made it this far, and happy holidays!!