• Resolved actuaryonfire

    (@actuaryonfire)


    Hi,

    I would like to display different text to the reader based on the value of a calculated expression. I don’t know Java, but I’m sure there is an easy way to just use Fields.

    Example

    0> fieldname1+fieldname2 < 10 output “Your weight is acceptable”
    10>= fieldname1+fieldname2 < 20 output “You are over-weight”
    20> fieldname1+fieldname2 output “You are obese”

    Many Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @actuaryonfire

    You should use conditional statements as part of your equation, as follows:

    (function(){
    var result = fieldname1+fieldname2;
    
    if(AND(0<result, result<10)) return 'Your weight is acceptable';
    if(AND(10<=result, result<20)) return 'You are over-weight';
    if(20<=result) return 'You are obese';
    
    })()

    Best regards.

    Thread Starter actuaryonfire

    (@actuaryonfire)

    Thanks for the quick reply. Where do I paste that code though?
    Do I use a Calculated Field or HTML Content?

    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @actuaryonfire

    You must enter the equation into the “Set Equation” attribute in the settings of the calculated field.

    Best regards.

    Thread Starter actuaryonfire

    (@actuaryonfire)

    Many thanks for your helpful response!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Display text based on value of equation’ is closed to new replies.