LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect data type within Variant

I typically flatten the variant to xml using the aptly named Flatten to XML function.

0 Kudos
Message 11 of 20
(3,210 Views)

Well since you really want to walk THAT path...

 

JPD developed code that is now part of Open_G that parses variants.

 

You could either use his coe or look at what he is doing and apply it to your situation.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 20
(3,203 Views)

You may want to take a look at the Read/Write Anything VIs from Moore Good Ideas.  They can take any cluster and write it to an INI file.  The code is mostly unlocked so you could probably modify it to write to any other format you need.

0 Kudos
Message 13 of 20
(3,194 Views)

Yes that is another good example to harvest.

 

My nugget on control refs may be of some use.

 

But building off what Dave showed us...

 

restrcture the clusters as string (or enum) and a variant. That way all of the cluster will be converted the same way. Pull the variant from that conversion to a sub-VI that coresponds with the cluster type (driven by the string or the enum) and inside the appropriae sub-VI convert the sub-varian to the proper cluster type.

 

Ben

 

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 14 of 20
(3,188 Views)

Perhaps you could use something like this.

Message 15 of 20
(3,185 Views)

Take a look at the OpenG Variant Configuration File Library .  In particular Write Section Cluster      It does something very similar to what you need and should be easy to modify.

0 Kudos
Message 16 of 20
(3,153 Views)

Wow, thanks to everyone!  This is very helpful and I will start working through your suggestions.

 

Erik

 

0 Kudos
Message 17 of 20
(3,148 Views)

In the end of it all, I still believe the LVOOP approach is elegant, easy to maintain and robust.

 

negative:

 

Learning curve.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 18 of 20
(3,144 Views)

[Wayne C writes: "Take a look at the OpenG Variant Configuration File Library .  In particular Write Section Cluster      It does something very similar to what you need and should be easy to modify"]

 

I was curious about your proposed solution... I put together something really fast just to see if it would work... and it did! disclaimer: it might not be the most elegant solution

 

See attachment -compiled in LabVIEW 2015-

0 Kudos
Message 19 of 20
(2,275 Views)

You also might consider upgrading to LabVIEW 2015

I have not looked into these functions myself but.....I have a bit of faith

 

4 years of NI R&D efforts since the last post might have obsoleted your efforts


"Should be" isn't "Is" -Jay
0 Kudos
Message 20 of 20
(2,250 Views)