Expand my Community achievements bar.

How do I populate a text field based on the numeric value of a number field?

Avatar

Level 1

I'm trying to populate a text field given a value in a numeric field that is calculated. For example. if the number in the field is less than or equal to 10, the text field would automatically say "There is low risk", if the number is greater than 10 but less than or equal to 20, the text field would automatically say, "there is moderate risk". I've attempted this using if then statements but i have been unsuccessful. Any help would be great. Thanks in advance.

2 Replies

Avatar

Level 10

Hi,

Try this JavaScript in the calculate event of a TextField, make its appearance none, protected and caption none ... so it looks like a Text object.

 

switch (true)

{

    case NumericField1.rawValue <= 10:

               this.rawValue = "There is low risk";

                 break;

     case NumericField1.rawValue <= 20:

                this.rawValue = "There is moderate risk";

         break;

     default:

                this.rawValue = "There is high risk";

 

}

 

Regards

Bruce