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!
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:>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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.