Referencing of form variables within a "Valid If" expression

Suppose I have a table,

TableA(Column1, Column2)

In the Column1’s “Valid if - EXPRESSION ASSISTANT”, the [_THIS] refer to the Column1’s value shown on TableA’s forms (Add or Edit). How can I refer/use the Column2’s form value in the Column1’s EXPRESSION ASSISTANT?

Regards,

Solved Solved
0 11 900
1 ACCEPTED SOLUTION

Functions that do table lookups, like FILTER(), LOOKUP(), and SELECT(), actually reference the table, not the copy of the row in the editor. Try this to get the saved copy:

LOOKUP(
  [_THISROW].[key-column],
  "table-name",
  "key-column",
  "Void"
)

replacing table-name with the name of the table and key-column with the name of the table’s key column. Note that [_THISROW]. is required in the above.

You can then wrap this LOOKUP() expression in ISNOTBLANK() in your Valid If expression.

See also:

View solution in original post

11 REPLIES 11

Hi @Swoopy,

If I clearly understand your requirement, if you wish to use value from Column2 in the valid if of Column1 , please use an expression something like [Column2]= “Great” or [Column2]>10

In short mention column2 name and a value for that column that makes Column1 valid.

Please let us know if you are looking for something else.

Thank you. I’m too newbie in this environment

Hi @Swoopy,
No problem. We are all beginners in the initial stages for any new thing. Please do ask your questions anytime. AppSheet community is a great community.

2X_6_66febfc42224914add61780abca6d6859a62dc21.png

My table has a column Void containing texts (“No” and “Void”). I tested its value using ISNOTBLANK([_THISROW].[Void]) in Valid If of column Quantity. When open Edit form of this table, it shows “This entry is invalid” (which means it’s blank), why?

Remove [_THISROW]. from the expression.

My understanding of AppSheet environment is that the [Void] alone (without [_THISROW]) in Valid If refers to the value of Void field on the Edit form. I need to refer the Void value in the table I am about to edit its row.

Your understanding is incorrect.

I re-tested the [Void] alone without “[_THISROW].”

If the Edit form is just open, [Void] value is equal to the Void of that row saved in table.

If I change the Void field on Edit form, [Void] keeps the new value on-the-fly.

However, I have a situation that my condition requires to compare the old value of Void previously saved in table -with- the Void value selected by user on Edit form. But I don’t know how to refer to the table’s void value if user changes the void field.

Regards,

If you need to be able to use the previous value entered by a user, you’ll need some way to store that variable separately from the main data-entry field; this way you have two fields in which you can compare them against each other and do logic functions.

You’ll also need another field to be the “display” field - that watches the “change” field and if it’s empty it copies the original value, if it’s changed it copies the new value. This gives you a single field in which to display to users. Unless you wish to show the original and the change, etc… you can see there’s a lot here.


Alternatively, if you just need to trigger a workflow if someone has changed a value from the original, there’s a way to reference the previous value of a form in logic:



Functions that do table lookups, like FILTER(), LOOKUP(), and SELECT(), actually reference the table, not the copy of the row in the editor. Try this to get the saved copy:

LOOKUP(
  [_THISROW].[key-column],
  "table-name",
  "key-column",
  "Void"
)

replacing table-name with the name of the table and key-column with the name of the table’s key column. Note that [_THISROW]. is required in the above.

You can then wrap this LOOKUP() expression in ISNOTBLANK() in your Valid If expression.

See also:

Thank you so much. Now I’am able to carry on my learning project.

Top Labels in this Space