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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

GetValue() output

Rais
1-Visitor

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

Thanks in advance !!!

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:Rais)

Rais Patel wrote:

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

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

1.png

View solution in original post

4 REPLIES 4
Werner_E
25-Diamond I
(To:Rais)

Rais Patel wrote:

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

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

1.png

LucMeekes
23-Emerald III
(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

Werner_E
25-Diamond I
(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.

Rais
1-Visitor
(To:Werner_E)

Thanks for the solution Werner Exinger,

It is working now ...

Announcements

Top Tags