# Director Lingo

Currently Being Moderated

## How to get the value from textInput Component to perform calculation?

### Mar 8, 2012 2:22 PM

Tags:

I need some help here...I'm trying to get the value of user input from the TextInput Component which is the age, height and weight to calculate the bmr and display the result in member("result").text.

How am i suppose to let the integer pass through in order for me to perform calculation? Would appreciate if anyone can help me out with this, thanks!

Below are the formula :

The Harris Benedict equation estimates BMR:

For women: (9.56 x w) + (1.85 x h) – (4.68 x a) + 655

For men: (13.75 x w) + (5 x h) – (6.76 x a) + 66

Replies
• Currently Being Moderated
Mar 9, 2012 9:19 AM   in reply to Babeteflonblue

Put this in your "Done" button's behavior: (assuming you have a global variable for male vs female, called globalGender--change to what ever you have)

global globalGender

if globalGender = "Female" then

member("result").text = (9.56 x value(member("weight").text)) + (1.85 x value(member("height").text)) – (4.68 x value(member("age").text)) + 655

else

member("result").text = (13.75 x value(member("weight").text)) + (5 x value(member("height").text)) – (6.76 x value(member("age").text)) + 66

end if

|
Mark as:
• Currently Being Moderated
Mar 9, 2012 11:11 AM   in reply to Babeteflonblue

My mistake. You can only asign a string to the text property of a text member. Just need to convert the value returned to a string using the string function.  Use this

member("result").text =  string((13.75 * value(member("weightText").text)) + (5 * value(member("heightText").text)) - (6.76 * value(member("ageText").text)) + 66)

|
Mark as:
Actions

#### More Like This

• Retrieving data ...

#### Answers + Points = Status

• 10 points awarded for Correct Answers