How to check if form value is unique in table column

Hello,

I am adding entries to a table called sampleTable via a form called addSamplesForm. For one of the form questions, I would like to have a validation rule that checks if the entered value is unique in the column imr_id in the table sampleTable. What is the easiest way to set this up?

Thanks!

I'm going to assume that the query getSamples is the one powering the table.

Then {{!getSamples.data.imr_id.includes(self.value)}} is the validation rule you're looking for.

1 Like

Thanks Mahmoud,

That works great - gives an instant update while filling the form if the input is true or false.

I also tried setting ‘unique’ to True in the settings for the IMR ID column of the resource table. And then triggering a modal frame to appear on query failure to tell the user that IMR ID must be unique. That seems to work too.

1 Like