Hello. I have a โCUSTOMERโ table with a column named โCUSTOMER IDโ , โCUSTOMER NAMEโ.
I understand that I can get current rowโs customerโs name by using [CUSTOMER NAME] expression.
My question is: When I edit a certain row, if I want to refer to initial value of โCUSTOMER NAMEโ (the valued being stored in database, not currently editing value), what should I do?
p/s: I can get it by
SELECT(CUSTOMER[CUSTOMER NAME] , [CUSTOMER ID] = [_THIS].[CUSTOMER ID])
Is there any shorter, more elegant way to do? I tried [_THISROW].[CUSTOMER NAME] but it does not return the text from that column.
Solved! Go to Solution.
Not really. The most succinct way is like this:
LOOKUP(
[_THISROW].[CUSTOMER ID],
"CUSTOMER",
"CUSTOMER ID",
"CUSTOMER NAME"
)
Not really. The most succinct way is like this:
LOOKUP(
[_THISROW].[CUSTOMER ID],
"CUSTOMER",
"CUSTOMER ID",
"CUSTOMER NAME"
)
Thank you very much Steve.
While this partially resolved my problem, it is not exactly what I wanted.
My CUSTOMER TABLE has following columns: CUSTOMER ID (key column) , CUSTOMER NAME, CUSTOMER ADDRESS, SEX (with value {Male , Female}), and a virtual column named TEST.
I understand that if I want to get value from SEX column and assign it to TEST, then I simply put [SEX] at App formula field of column TEST. This works perfectly well.
But, example, row 1 of my CUSTOMER table has following value:
{โCUSTOMER IDโ : โid01โ , โCUSTOMER NAMEโ : โJane Doeโ , โCUSTOMER ADDRESSโ : โn/aโ , โSEXโ : โMaleโ , โTESTโ : โMaleโ}
During EDIT mode, which mean when I am editing โid01โ customer, when SEX column value changed to โFemaleโ, I want the TEST column still holds the value of โMaleโ as it is being stored in the database, not the value that user is changing.
Now, I can get this by using App formula:
SELECT (CUSTOMER[SEX] , [CUSTOMER ID] = [_THIS].[CUSTOMER ID])
or, I may use your suggested solution as
LOOKUP ([_THIS].[CUSTOMER ID] , 'CUSTOMER' , 'CUSTOMER ID' , 'SEX')
but it is way too long syntaxโฆ
I thought that [_THISROW].[SEX] would return my expected value, but it doesnโt.
Is there anything explicitly like [_THISROW].[SEX].[SERVER-STORED-VALUED]
?
If there isnโt, then I am glad that I am using best of Appsheet already. Thank you very muchโฆ
You want to set the Initial Value to [SEX]. Then it wonโt change after edit unless you forcefully edit it.
No, thereโs no simple way to reference the stored value. Youโll have to use SELECT() as you already are or LOOKUP() as I suggested. Both are equivalent.
Thank you. I have marked your answer as resolved solution.
P.s I still prefer SELECT to LOOKUP for easier syntax.
User | Count |
---|---|
44 | |
30 | |
24 | |
23 | |
13 |