Versions Compared

Key

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

...

  1. Add a Single/Multiple Answer Lookup Table:
  2. Click on the "Lookup Table Data" question
    Image Removed
    Image Added
  3. Edit the following fields:
    Image Added
    1. Lookup Table: ignore that for now
    2. Value Field: what you want to save as an answer (usually an id or a code). For locations you can use site_code or @id.
    3. Label Field: what you want to display to the user. For locations you can use name
    4. (Optional) Filter: can be used to filter the locations displayed.
      Image Removed
    The tricky part is now to modify the xml to point the question to the location table. To do so:
    1. Click on Tools / Edit Source XML on the top right corner of the form builder:
      Image Removed
    2. In the XML search for a select1 node holding your lookup question. It should look like this:
      Image Removed
      In this example my lookup question is /data/location_loookupThen in the expression <itemset nodeset="instance('products')/products/product">, replace the instance with the instance of your location. For exampleclick on the 3 dots next to the field Image Addedand complete the following fields.(star)
      Image Added
      1. Query expression: put here your location instance. For example:
        1. if you want to display the list of states: instance('locations')/states/state
        2. if you want to display the list of districts of a previously selected state: instance('locations')/states/state[site_code=/data/state_selected]/districts/district
          where /data/state_selected is the state previously selected.

...

      1. Instance ID: locations
      2. Instance URIjr://fixture/commtrack:locations

    1. Value Field: what you want to save as an answer (usually an id or a code). For locations you can use site_code or @id.
    2. Label Field: what you want to display to the user. For locations you can use name
    3. (Optional) Filter: can be used to filter the locations displayed.

(star) If you don't see the 3 dots (Image Added), you need to activate a feature flag in your project settings.

Add your project space name to the feature flag 'Allows user to configure itemsets for more than lookup tables', here.