If you are on a sufficiently recent version, you can use the @CALCTEXT
action tag to return the colour code based on the value:
@CALCTEXT(if([acuity]<=3,'Green',if([acuity]<=6,'Yellow','Red')))
Another way (or if you don't have @CALCTEXT
) is to have a calculated 'helper' field and use its value in a @DEFAULT
action tag. So, a field [acuity_code]
would have the calculation:
if([acuity]<=3,1,if([acuity]<=6,2,3))
Them, a field [acuity_colourcode]
could have these options:
1, Green
2, Yellow
3, Red
And an action tag:
@DEFAULT='[acuity_code]'
[acuity_colourcode]
must be on a different form or page, as piping into @DEFAULT
requires that the value exists in the database on page load; it's not dynamic or performed in-browser like branching logic or a calculation. So [acuity]
and [acuity_code]
would be on one page, and [acuity_colourcode]
would be on a subsequent page.