There are two apps. The task is to copy data from one row in app1 to a corresponding row in the app2. The tables in the two different apps are of the same name with the Key column of the same name.
Mainly I meant he can’t pick the row to be updated because he doesn’t have direct access to that “other” table in app2 to choose the row in the first place so he would need to add access to that “other” table.
The problem is that you cannot select the row to be updated inside of the JSON. The row MUST be selected and passed into the API step
This part I was just plain wrong and confused myself. There is a row passed in but it would be the row that was changed in app1, which is what is currently happening.
Now comes the dicey part…as far as I know, AppSheet treats Key column values as distinct “data types” when you attempt to match the key columns directly between two tables, e.g. [Key1] = [Key2] - even if they are the same value - they are considered two different keys. This is based on experience. When trying to find a row in table2 using the key column from table1 the result was “DataType mismatch” errors.
It was solved by converting the key value to TEXT and then lookup by the text value instead.
I just don’t know how JSON handles this.
So…Returning the to the original JSON, it had
...
"ID PRENOTAZIONE": "<<Any(Select(ESCURSIONI[ID PRENOTAZIONE],[_THISROW].[ID PRENOTAZIONE]=[ID PRENOTAZIONE]))>>",
"ID PRENOTAZIONE": "<<[ID PRENOTAZIONE]>>",
...
which won’t work firstly because the Key column is specified twice but also, I believe, the SELECT won’t work because it is selecting the Key value from app 1 and not app 2 - resulting in wrong key column used.
…BUT would this work?
{
"Action": "Edit",
"Properties": {
"Locale": "en-GB",
"Timezone": "W. Europe Standard Time",
},
"Rows": [
{
"ID PRENOTAZIONE": "<<**TEXT([ID PRENOTAZIONE])**>>",
"DATA ESCURSIONE": "<<[DATA ESCURSIONE]>>",
"ESCURSIONE": "<<[ESCURSIONE]>>",
"ESCLUSIVA": "<<[ESCLUSIVA]>>",
"NUMERO PASSEGGERI": "<<[NUMERO PASSEGGERI]>>",
"ADULTI": "<<[ADULTI]>>",
"BAMBINI": "<<[BAMBINI]>>",
"FREE": "<<[FREE]>>",
"NAZIONALITA": "<<[NAZIONALITA]>>",
"MAIL": "<<[MAIL]>>",
"ANAGRAFICA (NOME E COGNOME)": "<<[ANAGRAFICA (NOME E COGNOME)]>>",
"TELEFONO": "<<[TELEFONO]>>",
"AGENZIA":"<<[AGENZIA]>>"
}
]
}
If not then I believe the table from app2 must be added and then the JSON key column lookup adjusted like this:
...
"ID PRENOTAZIONE": "<<Any(Select(**ESCURSIONI_App2**[ID PRENOTAZIONE],**TEXT(**[_THISROW].[ID PRENOTAZIONE]**)**=[ID PRENOTAZIONE]))>>",
...
Thoughts???