
Announcements
Hello everyone,
I have a button that writes data into a table, and it works perfectly for a specific table name. However, I need to make it dynamic so that it updates a table based on a user’s input (a text field for the username).
I tried defining the table for each user, and while the LookUp function seems to be working fine, I’m getting an error with the UpdateIf function. The error says that the first argument of UpdateIf must be a collection.
Could anyone help me figure out how to make the button update the correct table based on the username input? I’d appreciate any guidance!
Thanks in advance!
Set(selectedTable; If(
Input_User.Text = "bperez"; bperez;
Input_User.Text = "crovera"; crovera;
Input_User.Text = "dsalva"; dsalva;
bperez
));;
Set(foundRow; LookUp(selectedTable; DateValue(Text(Date)) = DateValue(Text(formattedDate))));;
If(
IsBlank(foundRow.Proposal);
UpdateIf(
selectedTable;
DateValue(Text(Date)) = DateValue(Text(formattedDate));
{
Location: Text(Location_Input.Selected.Value);
Activity: Input_Activity.Text
}
);
Set(PopupVisible; true)
);;
Switch(
Input_User.Text;
"bperez";
If(
IsBlank(
LookUp(
bperez;
DateValue(Text(Date)) = DateValue(Text(formattedDate))
).Proposal
);
UpdateIf(
bperez;
DateValue(Text(Date)) = DateValue(Text(formattedDate));
{
Location: Text(Location_Input.Selected.Value);
Activity: Input_Activity.Text
}
)
);
"crovera";
If(
IsBlank(
LookUp(
crovera;
DateValue(Text(Date)) = DateValue(Text(formattedDate))
).Proposal
);
UpdateIf(
crovera;
DateValue(Text(Date)) = DateValue(Text(formattedDate));
{
Location: Text(Location_Input.Selected.Value);
Activity: Input_Activity.Text
}
)
);
"dsalva";
If(
IsBlank(
LookUp(
dsalva;
DateValue(Text(Date)) = DateValue(Text(formattedDate))
).Proposal
);
UpdateIf(
dsalva;
DateValue(Text(Date)) = DateValue(Text(formattedDate));
{
Location: Text(Location_Input.Selected.Value);
Activity: Input_Activity.Text
}
)
)
);;
Set(PopupVisible; true)