From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-29-2010 10:20 PM
Solved! Go to Solution.
01-29-2010 11:01 PM - edited 01-29-2010 11:02 PM
You are getting the error because you are trying to Unflatten from XML and wiring a variant, but the XML string does not describe a variant. The XML string for a variant is completely different than for a, say, numeric.
This is the XML string for a variant:
<LvVariant>
<Name>Variant</Name>
</LvVariant>
This is the XML string for a DBL:
<DBL>
<Name>Numeric</Name>
<Val>1.00000000000000</Val>
</DBL>
Thus, if you feed in the second string, you cannot provide a datatype of variant to the Unflatten From String function. This is like trying to turn an orange into an apple.
Saving control values to file is a subject that has come up many times. I would suggest doing a forum search as you will find solutions to this. OpenG has a set of VIs to this as well.
Other code comments:
01-29-2010 11:22 PM
01-29-2010 11:48 PM - edited 01-29-2010 11:49 PM
As far as I can tell it appears you found a bug. The Unflatten From XML does not properly handle a cluster of a string and a variant of something. The Get All method returns an array of clusters, with each cluster being a string and a variant.
If you do this:
then no error is generated.
But, if you do this:
you get an error.
Looks like a bug to me.
01-30-2010 01:07 AM
Thanks for your help. I had the suspcition it works in some instances and breaks down in others. I will be interested in what NI response will be. What I have done in the interim is use Unflatten to/from String combination instead of xml. That seems to be working. The only wrinkle is that I am using the deprecated Ctrl Val.Get All method because it has type desc, regular Ctrl Val.Get All does not.
01-30-2010 02:05 AM
01-30-2010 12:22 PM
aderogba wrote:Thanks for your help. I had the suspcition it works in some instances and breaks down in others. I will be interested in what NI response will be. What I have done in the interim is use Unflatten to/from String combination instead of xml. That seems to be working. The only wrinkle is that I am using the deprecated Ctrl Val.Get All method because it has type desc, regular Ctrl Val.Get All does not.
That method will work. There are other methods. As I indicated, this question comes up a lot, so if you do a search you will find suggestions. And, as I also noted, OpenG has VIs for this sort of thing.
01-30-2010 12:24 PM
muks wrote:
202001 - Unflatten from XML does not return string items from within a cluster
This is a different issue.
02-01-2010 11:58 AM
This behavior was reported in CAR #198717.
Regards,
02-02-2010 04:18 PM