Prevent registration of a new contract

Hi everybody.

I’m creating this application that helps my company with the internal control of our customers and create a “Flow” above our jobs.

We have this issue: Within this DetailiView we have some basic information about a certain company (our client) and one of these pieces of information is “Contratos” (contracts), which is basically a VirtualColumn with the REF_ROWS expression that shows the contracts are generated for that client. In this case, we have a contract that will expire today (31/08/2023) “”“Im from brazil, dates are that way here. Sorry for bad english btw”“”

After we know that, i don’t want people to register a contract in which the “Data do início do Contrato” (Contract start date) is within the previous contract date (which shows in the first image).

My idea: Put a [DataTermino] *> Today() in Valid_If formula on DataInicio

[DataTermino] means date of termination of the contrat.

It didn’t work because regardless of the date that the person puts in “DateInicio” a message will appear that “this code already exists”. I think it’s because the appsheet doesn’t know which contract i’m referring to

Anyway, I would be very grateful if someone could think of something to help me. :slightly_smiling_face:

Do you mean “a row with this key value already exists”? How is your key column configured?