Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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

danyinpcg
Level 1
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
_Bruce_Robertson
Level 10
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