Highlighted

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

Avatar

Avatar

danyinpcg

Avatar

danyinpcg

danyinpcg

07-07-2014

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.

Replies

Highlighted

Avatar

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372

Avatar

_Bruce_Robertson

MVP

Total Posts

1.8K

Likes

268

Correct Answer

372
_Bruce_Robertson
MVP

08-07-2014

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

Highlighted

Avatar

Avatar

danyinpcg

Avatar

danyinpcg

danyinpcg

08-07-2014

Works like a charm, Bruce. Thanks so much!