LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
manu.NET

New userfriendly API for Variant content analyse : Variant introspection functions

Status: New

Hello,

 

I would like to analyse dynamically and recursively the content of a variant objects.

 

For the moment, the Variant content analyse is quiet "low level", and not very userfriendly, with type casting, integer comparisons without enumerate values ... and so on ... Smiley Sad

 

This kind of Variant analyse library has been made by JKI in their tools Smiley Indifferent. ... But are all cases threated ? ... what about evolutions ? Smiley Frustrated

 

It would be nice to add such a kind of API directly into LabVIEW, complient with all existing types, and with evolutive behaviour according to new LabVIEW versions. Smiley Very Happy

 

It should also be nice to create enumarate values to be abble to easily know what is the content of a variant.

 

These functionnalities already exits with object references ... but variant has sometimes a more "dynamic behaviour " !

 

Here is a short, but certainly not complete list, of desired functions : (In a textual description way)

 

  • enumObjectType { cluster, Array , numeric , string , ... }  : List of all kind of objects
  • function getOjectType( object as variant ) as enumObjectType : Gets the type of a variant
  • function getObjectLabel( object as variant ) as string : Gets the label of an object
  • function getObjectCaption( object as variant ) as string : Gets the caption of an object
  • function getObjectValue( object as variant ) as variant : Gets the contained value
  • function getObjectContent( object as variant ) as variant [] : Gets an array of variant objects contained in the aggregate object passed as parameter
  • function getObjectAtIndex( object as variant , index as int ) as variant : Gets a element of an array at the specified index
  • ...
  • function setObjectValue( ...
  • function setObjectCaption( ...
  • ...

 

With such a kind of library, it would be simple to create powerfull, dynamic tools !!!

 

 

To make a comparison with TestStand, i like very much the API which give the ability to analyse and modify recusively the content of a "PropertyObject". (Very complete and open API Smiley Wink , Thanks TestStand staff !)

 

Thanks.

 

Manu.net.

Manu.net
3 Comments
crossrulz
Knight of NI

Just a correction:  the library you are referring to was developed by OpenG, not JKI.

 

And because of that library, I don't see NI spending precious resources to develop this unless there is a HUGE demand.


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
AristosQueue (NI)
NI Employee (retired)

I am sorry, manu, but I have no idea what you are requesting with most of these functions.

 

You use the term "object". Are you talking specificially about type inspection for LabVIEW class objects? No, I guess not because your first function says "all types of objects" and then includes possibilities like arrays and clusters. But there is already an enum of all the types in LabVIEW in the existing variant API. So I am not sure what you're talking about here.

 

Then I get to these two functions:

  • function getObjectLabel( object as variant ) as string : Gets the label of an object
  • function getObjectCaption( object as variant ) as string : Gets the caption of an object

Data inside a variant doesn't have a label or a caption. Only controls/indicators on the panel have these two properties.

 

Please define the term "object" in terms of what it is within LabVIEW that you are designating. Please tell me how that thing gets into a variant. That will go a long way to discussing what, if any, API additions are needed.

manu.NET
Active Participant

Hello AristosQueue,

 

I aggree with you, the 'object' term is certainly bad used here (Certainly due to my too poor english !!! )

 

If fact, when i speek about "object", i wanted to say "all labVIEW controls and indicators".

 

The aim of my need is to be abble to analyse recursively, all kind of controls and indicators, casted into variant, as you can do with "references". (FrontPanel.allObjects[] ... )

All what is available with "references" should be available with variants.

 

My need is to be abble to do generic VI's, with Variant input.

 

As Crossrulz says, an openG library does it very well ... but certainly not in a "complete way" .

 

I would prefer, if such a kind of low level library could be done by NI, and maintained with LabVIEW's upadates.

 

Here is a screen shot of an openG example ... The library allows to save and restore any kind of "control/indicator" in a ini file, automatically, by analysing it's content.

I would like to have such kind of variant analyse toolkit included in labVIEW.

 

Variant.png

 

I hope to be a little more "clear" ???

 

Bets regards.

 

Manu.net

 

Manu.net