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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

variant look up table options

So, I had listened to the NI web-presentation on Variant, got really excited, because it seemed exactly what I wanted to do, but then comes in the reality....

I have an XML file with settings for multiple sub-test, where obviously the names for specific controls are identcial, such as V-BAT, I-Limit, etc.  I was hoping that by feeding the variant with all these options into set attributes for variant as a value and giving it a name will somehowe keep the settings for different tests seprate, but it doesn't seem like the case.  Is there a work around for that?

I would have hoped to be able to querry the XML file based on the testName, convert the variant to a cluster and unbundle the controls.

 

 

0 Kudos
Message 1 of 12
(3,954 Views)

Hi,

 

There isn't a way that I'm aware of to perform the operation along one wire. You could however break it up for each sub-test. Here are some links that may be helpful for you.

 

Variant Data in LabVIEW -- Mastering a Higher-Level Way to Work with Data:

http://www.ni.com/white-paper/4998/en/

 

Using Variant Attributes for High-Performance Lookup Tables in LabVIEW:

https://decibel.ni.com/content/groups/large-labview-application-development/blog/2012/09/04/using-va...

 

I hope this helps!

 

-Kale

0 Kudos
Message 2 of 12
(3,863 Views)

This kind of sounds like an application for OOP.

 

You can have variants in your variable attributes.  And those variants can have their own attributes.  So you could have a variant attribute for each test and each of those have the specific test data in their attributes.

 

Or you could be fancy with the attribute name and somehow include the step name with the attribute.  Something like "TestName.I_Limit" as an example.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 12
(3,857 Views)

Maybe you can show us an example heirachy. Maybe make a list of all the levels like:

  • Test1
    • value
    • status
  • Test2
    • value
    • status

Its possible a variant table isn't the right solution for you. You might just need something as simple as an array of clusters. Maybe an array of variant tables would work. It's hard to say without seeing your heirarchy.

0 Kudos
Message 4 of 12
(3,838 Views)

Here's a couple options to flatten the config file (you can then save this to a file)

SettingsFile.png

0 Kudos
Message 5 of 12
(3,820 Views)

As an alternative, consider using the LabVIEW Container (https://decibel.ni.com/content/docs/DOC-36470). I created it for exactly the reason you've noted. It is still very much a prototype but consider it as an option.

Message 6 of 12
(3,802 Views)

(I've never used it and am not affiliated with them, but the documentation looks promising.) Check out the EasyXML Toolkit for LabVIEW by JKI. Your boss would probably save a lot of money paying them a few bucks rather than having you reinvent the wheel.

 

Basically this allows you to read and write XML files by mapping their structure to clusters.

Jarrod S.
National Instruments
0 Kudos
Message 7 of 12
(3,757 Views)

@crossrulz wrote:

This kind of sounds like an application for OOP.

 

You can have variants in your variable attributes.  And those variants can have their own attributes.  So you could have a variant attribute for each test and each of those have the specific test data in their attributes.

 

Or you could be fancy with the attribute name and somehow include the step name with the attribute.  Something like "TestName.I_Limit" as an example.


Thanks for the good idea. I use often variant attributes for lookup tables, or sometimes to search for unique string values, etc... I never thought about using the attributes of the variant value of a variant attribute. I like that !

 

0 Kudos
Message 8 of 12
(3,745 Views)

@Chris_C. wrote:

As an alternative, consider using the LabVIEW Container (https://decibel.ni.com/content/docs/DOC-36470). I created it for exactly the reason you've noted. It is still very much a prototype but consider it as an option.


OOOOORRR, you could look at the totally better and cooler (and more experimental) Variant Repository.

 

But seriously XNodes should be used with caution and behind that code is really just read and write Variant Attributes which is all you need for a lookup table.

0 Kudos
Message 9 of 12
(3,641 Views)

Now now Hooovahh.. sticks and stones, sticks and stones Smiley Happy

Actually as I've gone out teaching, I've refered people to your API. And I mentioned your API in my LabVIEW tech web cast on the variant lookup table

0 Kudos
Message 10 of 12
(3,626 Views)