I have a form and a button with which I want to send data from input fields to a table. The logic is as follows: there are AppId fields and two corresponding attribute fields. It should result in creating/updating two rows in the table.
The code goes like:
Set(var_DataSet_Name, TXTInput_Dataset_Name.Value);
Set(var_DataSet_Name_Lock, true);
If(
IsBlank(LookUp('Table1', 'AppId' = TextInput1.Value)),
Notify("no records found", NotificationType.Error),
Patch('Table1', LookUp('Table1', 'AppId' = TextInput1_1.Value),
{
'attribute1': TextInput2_1.Value,
'attribute2': TextInput3_1.Value
}
)
);
If(
IsBlank(LookUp('Table1', 'AppId' = TextInput1.Value)),
Notify("no records found", NotificationType.Error),
Patch('Table1', LookUp('Table1', 'AppId' = TextInput1_2.Value),
{
'attribute1': TextInput2_2.Value,
'attribute2': TextInput3_2.Value
}
)
);
Refresh('Table1');
The problem is that that only the first patch works, so only the the row defined with AppId’ = TextInput1_1.Value gets updated and the attribute1 and attribute2 values are fetched from the form.
I tried different combinations to debug the issue. If I switch the order of patches in the code:
Set(var_DataSet_Name, TXTInput_Dataset_Name.Value);
Set(var_DataSet_Name_Lock, true);
If(
IsBlank(LookUp('Table1', 'AppId' = TextInput1.Value)),
Notify("no records found", NotificationType.Error),
Patch('Table1', LookUp('Table1', 'AppId' = TextInput1_2.Value),
{
'attribute1': TextInput2_2.Value,
'attribute2': TextInput3_2.Value
}
)
);
If(
IsBlank(LookUp('Table1', 'AppId' = TextInput1.Value)),
Notify("no records found", NotificationType.Error),
Patch('Table1', LookUp('Table1', 'AppId' = TextInput1_1.Value),
{
'attribute1': TextInput2_1.Value,
'attribute2': TextInput3_1.Value
}
)
);
Refresh('Table1');
then the other one works. And if I replace variables in both patches with fixed strings ( { 'attribute1': "aaa", 'attribute2': "bbb" }
) it works for both of them. What could be the reason of such behaviour?
user26167691 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.