Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Referencing lookup tables in form display condition

...

  • For this to work, the user must select the case BEFORE filling out the form.  This means that the "Menu Mode" setting on the module must be set to "Display module and then forms", and every form in the module must require a case.
  • It accepts the same kind of logical expressions as the Form Builder (see sections above), EXCEPT you must add ./ before any case property name. (For example, in Form Builder, you’d reference something as /data/edd. Here, it would simply be ./edd)
  • For example, write the following to say the expected delivery date (property name "edd") must be within the next week:  today() - ./edd <= 7
  • You can also refer to properties of some special cases too.
    • Use "#user" to refer to user case properties. e.g. #user/experience_level > 3
      • If a user does not have a value for the case property, you will see an error that says: "Logic references instance(commcaresession)/session/user/data/(...) which is not a valid question or value".
      • In order to avoid this, add an if() statement to check whether the case property exists first. For example:
        • if(count(instance('commcaresession')/session/user/data/USER_PROPERTY) > 0), instance('commcaresession')/session/user/data/USER_PROPERTY = 1, 0)
    • Use "#parent" to refer to the parent case of a child case. e.g. date(#parent/dob) >= date('1997-01-01')
    • Use "#host" to refer to the host case of an extension case. e.g. #host/suburb = #user/suburb
  • Referencing lookup tables on a form display condition uses a slightly different syntax than in app-builder. Here are some examples :
    •  instance('item-list:country')/country_list/country/id != "kenya"
    • instance('item-list:user_permissions')/user_permissions_list/user_permissions[user_role=#session/user/data/user_role]/f_register_household = '1')

How will this affect exports?

...