NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting decimal variables to octal labels using TestStand expression?

Solved!
Go to solution

Hello all,

 

I am currently using TestStand to read and write ARINC data for my application. Now, the ARINC card only takes decimal values, so I must convert all the octal labels to decimal and set them in TestStand such that the ARINC card accepts it. So, when I read the variables coming out, I name them for the log file, but I need to convert the decimal values to octal labels such that the test operators do not get confused. 

 

All in all, I need to know is there an expression to take the decimal value and convert it to octal in the expression space? 

 

Thanks!

CLD | CTD
0 Kudos
Message 1 of 4
(4,187 Views)

Not aware of any expression for conversion.

But i tried this.

Declared two variable:

 

One normal number type ( which holds decimal value).

Other a  number type but numeric format changed to octal.

 

Whenever i need to display octal from decimal then use this in a statement step type ---- locals.oct = locals.dec

When need to convert dec to oct then locals.dec=locals.oct.

 

For showing to user in message popup str(locals.oct) will work out will display in octal and str(locals.dec) will display in decimal.

 

Hope this helps.

0 Kudos
Message 2 of 4
(4,176 Views)
Solution
Accepted by topic author ChrisK88

Convert to octal string: Str(Locals.Local, "%#o")

Remove the # if you don't want the radix prefix.

 

Convert to decimal string if you want an integer:

Str(Locals.Local, "%i")

or for floating point:

Str(Locals.Local, "%g")

 

Hope this helps,

-Doug

Message 3 of 4
(4,163 Views)

@dug9000 wrote:

Convert to octal string: Str(Locals.Local, "%#o")

Remove the # if you don't want the radix prefix.

 

Convert to decimal string if you want an integer:

Str(Locals.Local, "%i")

or for floating point:

Str(Locals.Local, "%g")

 

Hope this helps,

-Doug


I think this does not work for Octal numbers, right ? I can't turn off the radix prefix for octal numbers.

0 Kudos
Message 4 of 4
(2,571 Views)