07-23-2010 08:06 AM
The parsed data from XML Parser gives me all the data and specifications in the string format. I want to convert these data into various (all available) data types. Is there a possible solution for it?
Solved! Go to Solution.
07-23-2010 08:28 AM
Can you specify a particular data type that you are not able to?
07-23-2010 09:03 AM - edited 07-23-2010 09:05 AM
07-26-2010 02:27 AM
Thank you for the suggestion.
But I need something that can change e.g. String: ''10'' in to I-32 ''10''. Type cast gives me the value related to string that is ''1952804352'' in I-32 indicator. I don't know how to use that value to get ''10''.
07-26-2010 02:50 AM
Use decimal string to number
07-26-2010 03:02 AM
@muks wrote:
Use decimal string to number
Specifically, you can define a constant with a different datatype on the input on the lower left if you need a different datatype (e.g. U8, I64, DBL, etc) Are all your values integers or do you also need to scan fractional numbers? In this case, you should use "fract/exp string to number" instead.
07-26-2010 04:26 AM
Yes you are right.
I can change integers only. All integeer types.
But I want all possible datatypes in input so that I can change them to appropriate output.(U8, 16, 32, Double, string, etc)
07-26-2010 04:56 AM
R_Chintan wrote:But I want all possible datatypes in input so that I can change them to appropriate output.(U8, 16, 32, Double, string, etc)
Do you still have a question or are you just repeating my answer in slightly different words?
(The input is always string, and for the output you need to decide on the most appropriate datatype when designing the program. I am curious why you would specify string as a possible output. Since you already have a string, no code is needed for this, right?)
07-26-2010 05:41 AM
The default conversion is I32. Right click properties and choose the required conversion required.
07-26-2010 08:57 AM
@altenbach wrote:
R_Chintan wrote:But I want all possible datatypes in input so that I can change them to appropriate output.(U8, 16, 32, Double, string, etc)
Do you still have a question or are you just repeating my answer in slightly different words?
(The input is always string, and for the output you need to decide on the most appropriate datatype when designing the program. I am curious why you would specify string as a possible output. Since you already have a string, no code is needed for this, right?)
I suspect the poster is looking for something like a "dynamic" Scan From String function. One where you enter the format string programmatically, and the outputs "automagically" change datatype at run-time. Such a beast, of course, does not exist. If this is the case, I would suggest using a polymorphic VI instead (one that would use a numeric constant to select the specific type of conversion so you'd get the "appropriate" datatype for the output).