Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

ConfiForm: Duplication Check Rule not working

Rachel Andrews August 31, 2023

Hello,

I have created a ConfiForm and would like to make sure all entry names are unique by checking the two fields "field1" and "field2". This rule is implemented in the ConfiForm Rules for Field Definition Macro and is currently designed to ignore spaces in comparing this field combination with other entries stored in the ConfiForm. However, this rule does not seem to work reliably and I do not understand what I am doing wrong. The rule is currently set to: 

field1.text.trimAllSpaces:[entry.field1.text.trimAllSpaces] AND !id:[entry.id] AND field2.text.trimAllSpaces:[entry.field2.text.trimAllSpaces]

Any help is appreciated, thanks! 

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
September 1, 2023

Hi @Rachel Andrews 

I would approach this differently

Using this condition

field1.trimAllSpaces:[entry.field1.trimAllSpaces] AND field2.trimAllSpaces:[entry.field2.trimAllSpaces] AND _count:>1

See this demo

https://recordit.co/S0cbRDwjZ3

And the whole configuration for the reference as page storage format

<ac:structured-macro ac:macro-id="21639158-59b6-4699-a0e3-ed8d3503c98f" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">form</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="00de05f4-8378-42d6-ab95-e41d39d00a67" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="02a4ff8e-8fb3-4715-bc5e-34aacc0900db" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">field1</ac:parameter>
<ac:parameter ac:name="fieldLabel">field1</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="d125f9bc-1b6a-43ad-8894-4d052999b87d" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">field2</ac:parameter>
<ac:parameter ac:name="fieldLabel">field2</ac:parameter>
<ac:parameter ac:name="type">text</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="243d6340-0767-4fbd-b7e5-ea8ca0b461b4" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">field1.trimAllSpaces:[entry.field1.trimAllSpaces] AND field2.trimAllSpaces:[entry.field2.trimAllSpaces] AND _count:&gt;1</ac:parameter>
<ac:parameter ac:name="fieldName">Duplicated entry</ac:parameter>
<ac:parameter ac:name="action">Validation rule dataset</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro>

Alternatively, I would use this rule type instead - https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Validateuniqueness Much easier to test for unique values in multiple or single fields

Alex

Rachel Andrews September 5, 2023

That seemed to work, thanks! 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events