10-21-2009 04:05 PM
Solved! Go to Solution.
10-22-2009 08:12 AM
Hello,
"Hexadecimal", "Binary" and "Octal" are not types they are representations.
It's just the way You as the human would prefer to read the value. You don't have to do anything extra ordinary to change that representation in TestStand. So if you create a numerc in .NET(i.e. Int32 value = 255; ) and set it's representation to Hex in TestStand, test stand will display it for you as 0xff.
The same is for C# language:
Int32 value = 0x00FF;
means exactly the same to the compliler as
Int32 value = 255;
The representation is only a matter of choice of how you want to view the value it's not the value type.
Hope this helps,
Maciej
10-22-2009 08:54 AM
Maciej-
Yes, I realize TestStand stores everything as an Int32 but it affects how the number is displayed in the test report. The value 255 will be displayed as 255 in decimal, 0xFF in hex, 0c377 in octal and 0b11111111 in binary. I need to allow my users to change the way a number is displayed at runtime depending on their needs. TestStand allows this to be statically set from the SequenceEditor Variables tab (see attachment) and I want to do the same thing programatically. I was using TestStand's name "type" from this dialog for what you are calling "representation".
10-22-2009 09:39 AM
Hi,
-------
Maciej-
Yes, I realize TestStand stores everything as an Int32 but ......
-------
As I know, TestStand stores very number as 8byte floating point (double)
To get the format types would use PropertyObject.NumericFormat
or PropertyObject.GetFormattedValue
Hope this helps
Juergen
10-22-2009 12:09 PM
Sorry, I misunderstood your intention,
j_dodek seems to have properly understood you and he gave you the good answer.
10-22-2009 04:33 PM
Maciej, Juergen-
Thanks for the suggestions.
PropertyObject.NumericFormat works great for setting the 'type'. I had played with this prior to posting the question but now I see I had an error in the format string making me think it wasn't working.
PropertyObject.GetFormattedValue will give me the 'type' of the Number variable as long as the "Show Radix Prefix" is checked in the Numeric Format dialog since this will include the radix in the formatted string... "0x, 0c or 0b". I can then look to see which format the data is in. This isn't quite as foolproof as actually being able to read the 'type' that is set directly from the API but should be a suitable workaround.
Steve