cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

1-Newbie

## GetValue() output

Hi,

in MathCad i have defined variable as

wllston = 17.32 lbf

when i read its value in API i am getting this value : "77.0462622041584"

is there any way so i will have same value as in MathCad.

Set oResult = msheet.GetValue("wllston")

output : value "77.0462622041584"

required output : 17.32

1 ACCEPTED SOLUTION

Accepted Solutions
24-Ruby V
(To:Rais)
 Rais Patel wrote:Hi,in MathCad i have defined variable as wllston = 17.32 lbfwhen i read its value in API i am getting this value : "77.0462622041584"is there any way so i will have same value as in MathCad.Set oResult = msheet.GetValue("wllston")output : value "77.0462622041584"required output : 17.32

The number you get is what your force would be in Newton. Its what you also get in Mathcad if you evaluate wllston/UnitsOf(wllston).

So Mathcad seems to store the value in standard force unit and remembers that the dimension is force.

With GetValue you obviously get only the value, not the unit.

So you have two ways out:

1) divide the value you get with GetValue by 4.4482216... Thats one pound force in Newton

or

2) define a new variable in Mathcad which holds the value 17.32... without unit and use GetValue on this variable. You achieve this by dividing your variable by lbf

4 REPLIES 4
24-Ruby V
(To:Rais)
 Rais Patel wrote:Hi,in MathCad i have defined variable as wllston = 17.32 lbfwhen i read its value in API i am getting this value : "77.0462622041584"is there any way so i will have same value as in MathCad.Set oResult = msheet.GetValue("wllston")output : value "77.0462622041584"required output : 17.32

The number you get is what your force would be in Newton. Its what you also get in Mathcad if you evaluate wllston/UnitsOf(wllston).

So Mathcad seems to store the value in standard force unit and remembers that the dimension is force.

With GetValue you obviously get only the value, not the unit.

So you have two ways out:

1) divide the value you get with GetValue by 4.4482216... Thats one pound force in Newton

or

2) define a new variable in Mathcad which holds the value 17.32... without unit and use GetValue on this variable. You achieve this by dividing your variable by lbf

23-Emerald II
(To:Werner_E)

I have an objection.

You should not call F/lbf the variable name 'Funitless', but rather 'F_in_lbf', or any other clarification that the variable's value is in lbf... But it certainly isn't unitless!

Other than that I'm fine with it.

Regards,

Luc

24-Ruby V
(To:LucMeekes)
 LucMeekes wrote:I have an objection.You should not call F/lbf the variable name 'Funitless', but rather 'F_in_lbf', or any other clarification that the variable's value is in lbf... But it certainly isn't unitless!

The variable itself IS unitless, but of course we associate a unit with its value, given the context.

So I agree that your suggestions for naming that variable might be the better choice.

1-Newbie
(To:Werner_E)

Thanks for the solution Werner Exinger,

It is working now ...

Announcements