LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
QFang

variant "name" input as numeric instead of string?

I have several times found myself using variants to create various types of sorted lookup tables data sets. (Variants "sort" attributes/records by the name automatically, taking a performance hit when creating/adding to the variant, but wicked fast to retrieve a named attribute, and when getting a list of all named attributes they are returned "sorted".)

 

Now, in many/most of those scenarios, I find myself wishing I could just name the attribute with a numeric input without the hassle of converting the numeric to a string.

 

For example, if you read the file-property of all files in a folder tree and put various information for each file into a cluster (e.g. size, last modified date, name etc.), this cluster would become the "attribute" or "record" that you add to a variant for quick lookup later. Now, of course you have many ways to name the attribute(s) depending on what you want to do. In one case, you may want to retrieve file attributes based on the oldest (or newest) "last modified" time.. currently one way to do this is to "format into string" the "last modified" time stamp data and use that as the attribute name. If you are careful with how you format it to string, the sorted string list will come back oldest to newest (e.g. format it as YYYYMMDDHHMMSS to get a decimal string that sorts oldest (least) to newest (latest). (Note that when getting lists of files from LabVIEW, the order of the returned files does not appear to be sorted by "modified" or "created" dates.)

 

It would be nice if instead the "name" input would support usage of numeric inputs directly. If this was implemented at a low enough level, then the string conversion would not only be hidden from us (users), but potentially be completely removed as I picture the "name" at a low enough level is just a unique identifier anyway..  If this could be made to allow the "name" terminal to accept time-stamp data types, strings, I/U32 and DBL I would be very happy indeed!

 

Please discuss in comments if this is good, bad, impossible, possible etc. etc.

Thanks,

Q

QFang
-------------
CLD LabVIEW 7.1 to 2016
4 Comments
AristosQueue (NI)
NI Employee (retired)

It might not look like it, but what you really want is this:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Implement-STL-like-standard-containers-Data-Structures...

 

In particular, the Map container. I'm going to close out this idea as a duplicate of that one, even though the particular solution you're asking for is not the same as the other idea, but because the other idea fully subsumes the use cases this one solves and is a much better solution for various other reasons.

Darin.K
Trusted Enthusiast
QFang
Active Participant

Please link me to Darin.K's suggestion as this is more in keeping with what I was asking for, I think. I really depend on the red-black sorting thing for most of my variant "not so obvious" use cases.

 

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Associative-Arrays/idi-p/1104538http://

QFang
-------------
CLD LabVIEW 7.1 to 2016
JordanG
NI Employee (retired)