Child pages
  • Using filter based on criteria rule

This is the documentation for ConfiForms Server/Data Center app

However, this might also work for ConfiForms cloud and in most cases it does. But please see this page to understand the differences between server and cloud versions of the ConfiForms app.

In ConfiForms you have a very powerful macro called ConfiForms Field Definition Rules to setup interactions and rules for your form, one of very powerful features is the ability to filter the options in the fields based on conditions.

There are 2 types of filtering rules:

  • Apply filter on field
  • Apply filter based on criteria


Apply filter on field

This is quite an easy one to use - you choose the field to apply the filter on and apply the filter (ConfiForms Filters). One note to mention is when you apply the filter on a smart field or on any non-simple field then you actually work on the dataset this field references. So, the filter should be constructed as you are on the dataset this smart field is using.

More about this action in the following tutorials and demos:

Apply filter based on criteria

This is a very powerful rule and dramatically extends the possibilities and conditions you can define to filter your field options on the form

Consider the following example

We have 2 forms. First form (form 1) is with options, while the second one (form 2) is the form that uses the options defined in the form 1. We have a smart field (dropdown) in form 2 that uses the data from form 1.

The forms look like this in the view mode

What we want to implement is the filter that shows for field "Choice" in form 2, only the values from form 1 that are "not used" in form 2

In the example above there shall be ONLY one option called "test 3" in the "Choice" field

How to achieve that!?

This is where ConfiForms Field Definition Rule with action set to "Apply filter based on criteria" helps

Here is how it can be configured

We apply the rule on "choice" field and tell that you are actually connected to form1 (f1) and use "id" field from the dataset in form 1 to match with the data in current form 2 dataset, comparing it with field "choice"

And that is because smart fields store the references to the records (internal IDs), so we compare it with ID's

And we check the option "Retain only unique rows on the target form" to keep only the records that are not yet "used"


Here is the complete storage 

Please be aware that form names were changed from f1/f2 to form1/form2 and you will need to setup the smart field for choice field in form 2 to point at your form 1

In the demo it points to specific page "38862971"

<ac:parameter ac:name="values">[38862971|form1|options|true||]</ac:parameter>
<ac:structured-macro ac:macro-id="8dd1a31e-842c-452f-a403-da2b75109fd1" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">form1</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="50cac5de-96aa-4850-8431-4c115969f2f3" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:parameter ac:name="formName">form1</ac:parameter>
      <ac:parameter ac:name="registrationButtonLabel">Register f1</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="42e3804d-4e0b-4a59-9f19-946512d3af19" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">options</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Options</ac:parameter>
        <ac:parameter ac:name="type">text</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<h2>f1 items</h2>
<ac:structured-macro ac:macro-id="f19ae23e-f351-4c5d-a2d8-c667737c64af" ac:name="confiform-table" ac:schema-version="1">
  <ac:parameter ac:name="formName">form1</ac:parameter>
  <ac:rich-text-body>
    <p>
      <br/>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<p>
  <br/>
</p>
<h2>form 2 with options filtered against registered ones</h2>
<ac:structured-macro ac:macro-id="e9cc4c25-7457-4304-b33b-4370d73f20a8" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">form2</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="aac4b0a1-1bf9-4d0a-91e1-ab36293ebfe9" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:parameter ac:name="formName">form2</ac:parameter>
      <ac:parameter ac:name="embedded">true</ac:parameter>
      <ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
      <ac:rich-text-body>
        <p>
          <br/>
        </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="fdb9e098-aae8-43ba-8f7b-72974f3f5e10" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">choice</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Choice</ac:parameter>
        <ac:parameter ac:name="values">[38862971|form1|options|true||]</ac:parameter>
        <ac:parameter ac:name="type">smartselect2</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="cd5e436b-31ac-4d2b-91ec-9f80b7587a06" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="condition">*</ac:parameter>
        <ac:parameter ac:name="fieldName">choice</ac:parameter>
        <ac:parameter ac:name="noPropagation">true</ac:parameter>
        <ac:parameter ac:name="action">Apply Filter based on matching criteria</ac:parameter>
        <ac:parameter ac:name="values2">form1:this</ac:parameter>
        <ac:parameter ac:name="values3">id</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>
<h2>f2 items</h2>
<ac:structured-macro ac:macro-id="fdb4dfe7-07fe-4331-bf94-ac6912a87f48" ac:name="confiform-table" ac:schema-version="1">
  <ac:parameter ac:name="formName">form2</ac:parameter>
  <ac:rich-text-body>
    <p>
      <br/>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>







  • No labels