How not to save if there is already a value in the column

  • 8 October 2021
  • 4 replies
  • 1 view

Hello i need some help
I would like to know how an error appears in a text box when I want to register a number that already exists in the column.
Please, is urgent

 


4 replies

Userlevel 5
Badge +13

I'm not sure I understand - you have a table with multiple rows and you want to make sure the value of a particular column is unique? To do so, you would need to loop through all of the rows in each table and for each one, do another loop looking to see if the value already exists in a row that isn't the current row. I can provide more details if I have identified the scenario correctly.

I am not sure i understand your question fully. If you may elaborate more that would be great. However, simplest way is to use the "for each row" under conditions to look through each line and within the loop use the advanced condition and put if the control in the add/edit state is not empty. And the action show a message, in the message you can choose the nature of the message which should be an error type. Important thing after also is put an action to stop rule execution. If there is an else to your if statement, i advise creating a rule and calling it using the execute another rule comman within the loop. That should sort you out. If it doesnt feel free to reach out


 


Cheers

I need it not to save the number if it already exists in the column.


I need more information to configure a control rules. 


If you give me an example, how i need to do or configured it, is so urgency. 

Userlevel 5
Badge +13

Here are the general steps, hopefully this can get you most of the way there:



  • Create a hidden checkbox named "Is Valid"

  • Create a hidden data label named "Current ID"

  • Create a hidden data label named "Current Value"

  • Create an unbound rule named "Validate Current". The actions of this rule should be:

    • For each item in the list

      • Advanced condition: If Current ID (data label created above) <> ID of this row AND Current Value (data label created above) = value of this row

        • Data Transfer: Set Is Valid = false







  • Create an unbound rule named "Validate". The actions of this rule should be:

    • Data Transfer: Set Is Valid = true

    • For each item in the list

      • Data transfer: Set Current ID = ID of this row and Current Value = value of this row

      • Execute "Validate Current" rule





  • Call "Validate" before saving. If "Is Valid" = false, then do not save and show an appropriate messsage

Reply