Can I use Valid_If constraint only when filling forms, but not when editing past input?

Hi,

In an Inventory, I’m using a Valid_IF to make sure I don’t sell a greater amount of product than the one I have. But sometimes I want to edit the sale (with an action button) and I no longer want the Valid_IF constraint to work, since I’m editing and not inputing a new sale.

This is my current Valid_IF, I want it to work ONLY when inputing a new sale and NOT when editing a past one.

[BarCode].[Available Stock]>=[Q]

Thank you!!

Try:

OR(
  ([BarCode].[Available Stock] >= [Q])
  IN([_ROWNUMBER], table[_ROWNUMBER])
)

Replace table with the name of the table containing the row you’re editing.

See also:

[FAQ: FILTER(), LOOKUP(), MAXROW(), MINROW(), REF_ROWS(), and SELECT()](https://community.appsheet.com/t/faq-filter-lookup-maxrow-minrow-and-select/24216/18) Tips & Tricks ?

Is this a new row?/Does this row already exist? Is this a new row? NOT(IN([_ROWNUMBER], My Table[_ROWNUMBER])) or: ISBLANK( FILTER( “My Table”, ([_ROWNUMBER] = [_THISROW].[_ROWNUMBER]) ) ) Does this row already exist? IN([_ROWNUMBER], My Table[_ROWNUMBER]) or: ISNOTBLANK( FILTER( “My Table”, ([_ROWNUMBER] = [_THISROW].[_ROWNUMBER]) ) ) In the above, replace My Table with the name of the table about which you’re inquiring. When modifying rows, such as in forms or wi…

1 Like

Thank you so much!!

1 Like