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
BedrockMission!

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?

Avatar

Avatar
Validate 1
Level 1
danyinpcg
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
danyinpcg
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
danyinpcg
Level 1

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

Avatar

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

269 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile

Avatar
Boost 50
MVP
_Bruce_Robertson
MVP

Likes

269 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 250
Boost 25
View profile
_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

Avatar

Avatar
Validate 1
Level 1
danyinpcg
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
danyinpcg
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
danyinpcg
Level 1

08-07-2014

Works like a charm, Bruce. Thanks so much!