Skip to content

displayif DeepDive

danielruss edited this page Mar 30, 2022 · 11 revisions

If you are creating a new module, please use the function implemented using math.js

This page describes the original knownFunctions that are no longer supported.


Known Functions

This displayif has many known functions. They include:

  • and(x,y)
  • or(x,y)
  • equals(x,y)

equals takes 3 types of values, numbers, strings or true/false
displayif=equals(ABC,3)
displayif=equals(ABC,"abc")
displayif=equals(ABC,true)
displayif=equals(ABC,_TODAY_) 

You can use equals(PREDICATE,false) to create a NOT statement. For example equals(equals(DEF,"abc"),false)
is equivariant to DEF!="abc"
  • doesNotEqual(x,y)
  • lessThan(x,y)
  • lessThanOrEqual(x,y)
  • greaterThan(x,y)
  • greaterThanOrEqual(x,y)
  • difference(x,y)
  • percentDiff(x,y)
  • isDefined(x,y)

isDefined returns the value of X if it exists, otherwise it returns Y
to check if a field exists use this syntax:
doesNotEqual(isDefined(STNUM,-1),-1)
  • isNotDefined(x,y)

isNotDefined will take x,y but it will  only check on X. If X is truthy then it will return false, otherwise it will return true
  • numberOfChoicesSelected(x)

The methods in displayif only accept 2 input values, however they can be nested. So while you cannot do


and(a,b,c)

where a b c are predicates, you can do:


and(and(a,b),c)

Further more a,b,c can be its own predicate, so it can be expanded to:


and(and(equals(VAR1,1),or(equals(VAR2,2),equals(VAR3,3))),and(equals(VAR4,4),equals(VAR5,5)))

Example 1:

Given requirement:


> DISPLAY IF:
> 1) SEX=02 OR
> 2) SEX=03 AND SEX = 06 OR 07

displayif implementation


displayif=or(equals(SEX,2),and(equals(SEX,3),or(equals(SEX2,6),equals(SEX2,7)))

Example 2:

Given requirement:


> DISPLAY IF:
> SEX = 01 AND GENDER IS ANY OF(02,04,05,06)

displayif implementation


displayif=and(or(equals(SEX,1),equals(SEX,3)),or(or(equals(GENDER,2),equals(GENDER,4)),or(equals(GENDER,5),equals(GENDER,6))))
Clone this wiki locally