cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the numeric format through the API

SOLVED
inp3dance
Member
Solved!

How to set the numeric format through the API

Hi,

 

I have an utility that imports limits from external resources and in that utility (C#) I would need to modify the numeric representation  so that what is defined as hexa in the external resource to be displayed as hexa after importing to TS as well.

Can U help me out if this is possible with the API and if so, what is the right methods for it?

 

Thanks in advance.

6 REPLIES 6
twardak.m
NI Employee (retired)

Re: How to set the numeric format through the API

Message contains an attachment

Hi!

 

I'm not sure if I understood you correctly, but I think your problem can be solved, without using API functions. Just double click on the name of variable and there you can change the representation - I attached an image.

 

If you still want to use API, let me know i will try to find something.

 

Best regards.

Marcin Twardak
Applications Engineer
National Instruments

inp3dance
Member

Re: How to set the numeric format through the API

Hi twardak.m,

 

I need to do it through the API to ensure that the same representation is used in both end of our data backend. The data is overwritten at each run so the manual modification would be really inconvenient.

I searched the TS API up and down but find no way to do it not even in TS ( I mean through the API, I'm familiar with the Numeric Format properties window).

Anyway, thanks in advance for the help.

twardak.m
NI Employee (retired)

Re: How to set the numeric format through the API

Message contains a hyperlink

Hi again,

 

I didn't find straight solution yet, but I think it is good way around:

http://digital.ni.com/public.nsf/allkb/1304B337E03E2E1A86257ACD004BAB06

 

If you want hexadecimal representation you need to change "%b" to "%x". I'm still keep looking for a better solution...

 

Best Regards

Marcin Twardak
Applications Engineer
National Instruments

inp3dance
Member
Solution

Re: How to set the numeric format through the API

Hi,

 

Just a few minutes ago we found this solution working:

  x.NumericFormat = "%#X";  where x is the PropertyObject pointing to the number. It is just not documented anywher for this method  that U can use X for hexa.

 

 

twardak.m
NI Employee (retired)

Re: How to set the numeric format through the API

I'm really happy you found the solution! Thank you for writting it here, maybe someone else will use it in the future Smiley Happy

 

Best regards

Marcin Twardak
Applications Engineer
National Instruments

inp3dance
Member

Re: How to set the numeric format through the API

Thanks for your effort!