[Thisrow].[before] for a column in app

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.

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.

1 Like

Thank you. I have marked your answer as resolved solution.
P.s I still prefer SELECT to LOOKUP for easier syntax.

1 Like