I have a table “Week” with a field called “NumWeek”.
When I am in a record of that table, I want to copy the value of “NumWeek” to another table called “Config” in the field “WeekConfig” when I press a button.
What would be the best way to do it?
The action “Data: execute an action on a set of row” by putting Reference Table : Config asks me for Reference rows which in my case is simple: LIST(“1”) since I only have one record.
Then it asks me for Reference Action and I have defined “TablaQueSem” in the table “Config”. From there I cannot mention the value of Week.[NumWeek] and I have no choice but to put an INPUT.
I have tried to use “Data : add a new row to another table...” putting the ID of “1” and it creates a record with that data but it empties the rest of the fields.
When you execute an action every time, will the [ Weekconfig] in “Config” table be updated by the [NumWeek] value from the record of the Week table. This Week table record is the record from where the action is initiated.
Thank you. Maybe someone has better solution with this configuration and I am missing some obvious point in my solution.
I have tested it with a bit longer configuration with 3 group actions and requiring addition of a column in the Week table. I can share it if you wish. Please let me know.
Maybe AppSheet should consider the action
“Data: set the values of some columns in other table”
allowing to indicate “For a record if this table”, “Reference Table” and instead of “Reference Action” put “Set these columns” as in the action “Data: set the values of some columns…”.
I think it is something very common and would be simpler than the method you propose (although this one works for me because it works).
You are welcome. Thank you for the update. Good to know it works.
I think some referencing between the two tables will help in reference actions.
In this particular case since there is only one row to be updated from many rows it was a bit challenge even for referencing which we solved by using USEREMAIL() based approach.
I still feel we may have an easier approach. If I can get one, I will post.
Based on the information you provided, I have changed it slightly.
I use a text field in the source table that I call Marker.
In the first action I give Marker the value of Yes.
In the second action I change the expression to: ANY(SELECT(Week[WeekNum], [Marker]=“Yes”))
In the third action, I give Marker the value of “”.
Okay. However I believe in multiuser environment, USEREMAIL() will work better.
If two or more users try to update the Config table simultaneously, there will be two or more rows with " Marker" filled and result will be unpredictable.