Home > Forum > Tips&Tricks > barcode unique across application?

barcode unique across application?
0

MVP
In reply to: Marcin

We have own barcode tapes and i wonder how prevent add two workflow with the same barcode. Barcode field is on the form. The only solution is check database by sql query? where this query should by placed?

Hi Marcin,

sorry, I probably got it wrong. So you just need to check if the value in a field is unique. I've a similar use case and wanted to display in the browser an alert to the user, whether the value is already used.

I created this business rule:

select {WFCONCOL:59}
from WFElements
where {WFCONCOL:72} = '{72}'
and WFD_DTYPEID = {DT:3}
and WFD_COMID = {COM_ID}
and WFD_ID <> {WFD_ID}

And used in the business rule in "Form rule to be executed on value change" if the return value is not empty, I clear display an alert and clear the value.

From the above query you need to change the document type {DT:3} and the field condition {WFCONCOL:72} = '{72}'. In the later one I compare the data stored in the column against the current one.
I'm returning another column because I used this text in the alert message.

Depending on how you are using this, you could use a validate action to verify that it's unique.

Best regards,
Daniel