How to create isInList Formula with Within Range?

Hello,

I'm trying to create a Dependent > Visible If formula.

Wherein

  • field_1 has dropdown value of 1 to 15 (e.g. 1,2,3,4 … 15)

Wherein there are 15 data fields that this formula needs to apply to

  • hidden_field_1 = Only visible if field_1 dropdown value is within 1-15
  • hidden_field_2 = Only visible if field_1 dropdown value is within 2-15
  • ...
  • hidden_field_15 = Only visible if field_1 dropdown value = 15

The goal is

  • If field_1 = 15, then hidden_field_1, hidden_field_2 ... hidden_field_15 must be visible.
  • Hi ,

    There are two ways you can go about solving your use case. The first method is to manually define the entire range of acceptable values in the formula. Taking your example, the formula for hidden_field_1 would be:

    isInList($field_1,createList("1","2","3","4","5","6",...,"14","15"))

    And the formula for hidden_field_2 would be:

    isInList($field_1,createList("2","3","4","5","6",...,"14","15"))

    The second method is to cast the dropdown value as a numeric value and then use the mathematic operators to determine whether the value is in range. The following formula would be what you use for hidden_field_1:

    and(not(equal($field_1,"")),greaterThan(number($field_1),0),not(greaterThan(number($field_1),15)))

    And the formula for hidden_field_2 would be:

    and(not(equal($field_1,"")),greaterThan(number($field_1),1),not(greaterThan(number($field_1),15)))

    The first and condition on the field not equaling an empty string is necessary if your dropdown field has a potential to be an empty value. For some reason, the field will be visible if it is set to the empty value and you do not have that condition in your visibility formula. 

    Chris

  • Will follow the second method as things to edit are fewer than the first method. Slight smile