Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

ConfiForms Form Definition
formNamef

 

categoryContractor CategorySELECT id, name FROM contractor_categories7422036e-9a6f-4455-92d9-7140131fb9dadbselect

subcategoryContractor Sub CategorySELECT id, name, contractor_categories_id FROM contractor_subcategories7422036e-9a6f-4455-92d9-7140131fb9dadbselect

subcategorycontractorcategoriesid:[entry.category.id]Apply Filter on a fieldcategory

"Dependency" is defined using "ConfiForms Field Definition Rule" with action to filter choices

Image Added

 

Rule is set to be connected to changes on "category" field (not shown on the screenshot, but it is the first parameter in the rules macro)

And important bit is the filter:

Code Block
contractorcategoriesid:[entry.category.id]

Why "contractorcategoriesid" and not "contractor_categories_id" as in the SQL defined? Because the way the field name is defined, allowing no non-alphanumeric characters in it's name. SQL query results become the dataset similar to internal datasets stored within ConfiForms.

 

Storage format

Code Block
  <ac:structured-macro ac:macro-id="14859127-f36f-4e7f-9de8-219a6790b6e3" ac:name="confiform" ac:schema-version="1">
  <ac:parameter ac:name="formName">f1</ac:parameter>
  <ac:rich-text-body>
    <ac:structured-macro ac:macro-id="fdff034e-b509-4a3f-ae55-ed872aa6d0be" ac:name="confiform-entry-register" ac:schema-version="1">
      <ac:rich-text-body>
        <p> </p>
      </ac:rich-text-body>
    </ac:structured-macro>
    <p>
      <ac:structured-macro ac:macro-id="2da9717f-57f5-4eda-9670-57123708c625" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">category</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Contractor Category</ac:parameter>
        <ac:parameter ac:name="values">SELECT id, name FROM contractor_categories</ac:parameter>
        <ac:parameter ac:name="extras">7422036e-9a6f-4455-92d9-7140131fb9da</ac:parameter>
        <ac:parameter ac:name="type">dbselect</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="415940f1-d144-445d-9b72-9821d0310930" ac:name="confiform-field-definition" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">subcategory</ac:parameter>
        <ac:parameter ac:name="fieldLabel">Contractor Sub Category</ac:parameter>
        <ac:parameter ac:name="values">SELECT id, name, contractor_categories_id FROM contractor_subcategories</ac:parameter>
        <ac:parameter ac:name="extras">7422036e-9a6f-4455-92d9-7140131fb9da</ac:parameter>
        <ac:parameter ac:name="type">dbselect</ac:parameter>
      </ac:structured-macro>
    </p>
    <p>
      <ac:structured-macro ac:macro-id="d6b863fc-69cb-45e3-bbeb-5c76578158f7" ac:name="confiform-field-definition-rules" ac:schema-version="1">
        <ac:parameter ac:name="fieldName">subcategory</ac:parameter>
        <ac:parameter ac:name="values">contractorcategoriesid:[entry.category.id]</ac:parameter>
        <ac:parameter ac:name="action">Apply Filter on a field</ac:parameter>
        <ac:parameter ac:name="actionFieldName">category</ac:parameter>
      </ac:structured-macro>
    </p>
  </ac:rich-text-body>
</ac:structured-macro>