Search the Community
Showing results for tags 'variant'.
-
Hi All, I had a question about variant data and variant attributes specifically. I have different datatypes, and for having a nice and neat wiring, I am storing an array of clusters made of a variant and a data tag, so I can insert a new datatype w/o changing anything and with no i/o problems. I use normal search for tag and retrieve data VI, and the same thing for adding new data or changing data. My qusetion was: can i Just use variant attributed to do the same? something like this? Are there any draw backs that I do not know of? Cheers, M
-
I'm probably missing something fundamental about how variants are stored in memory . I want to create an array of pointers to variants. I seem to be able to write quite happily, but when read; it causes a problem. The following VI demonstrates what I am trying to do. It runs through once quite happily, but on the second execution it fails on the DSDisposePointer (even though the variant has been written and read correctly). If you disable the read, then it doesn't crash so it must be something to do with the way I'm retrieving the data. Any help appreciated. varpointers.vi
-
Hi! I have to convert a dynamically generated array into a JSON string and back. Unfortunately I found that the un-flatten method loses the variant data. See the screenshot of FP and BD and the comments inside. JSON_Text_test.vi Is this a bug in JSON Text or is my data-construction not supported as expected? In case of the letter I have modify huge parts of my code. So I hope that it is a bug 😉 The 2nd thing I recognized is that the name "Value" of the cluster is not used during flatten. Instead the name of the connected constant / control / line is used. I found the green VI ("Set Data Name__ogtk.vi") at OpenG Toolkit that allows me to programmatically set the variant data name. As you can imagine I would prefer not to need the OpenG VI. Thanks in advance for your kind help 🙂
-
So sometimes when you do protocol decoding it is convenient to use a variant to store decoded data. For example you might have a 2 bit enumeration that is decoded like this: 00 -> Good 01 -> Bad 10 -> Ugly 11 -> Catastrophic If you cast the value to an enumeration that contains these values before hand you can see them on the variant control. If you use a Ring you will only see a value. I know that the LV flatten to string contains the enumeration strings but the encoding is a bit of a mystery, although it looks like the openg palette has figured some of it out to some degree. But to me it doesn't look like there is any reason i couldn't generate an enum to use inside the scope of a variant. Has anyone done this, or know how to generate the string for this purpose.
-
After working on the set cluster element by name xnode, it made me realize i could use the same concept to convert a variant array to a cluster. The technique is actually pretty simple, the xnode generates a case structure for each element in a cluster in cluster order, wherein a bundle by name is used to set the value and an unbundle by name is used to get the type, a variant to data is used to convert the data. This has some benefits over some methods, you are not limited to 255 elements, although that is not usually the case some of us are paranoid that clusterosaurus giganticous will be larger than expected. It also has a draw back that is that when converting from a variant array all the elements must have unique, non-blank names, and this is usually the case. I think this technique (though very brute-force) might be useful for some other things let me know what you guys think. VariantArrayToCluster.zip
-
I have Created a dll that takes a variant pointer and sets the value to a string. Its very simple... But i want to easily move information to and from LabVIEW with very little overhead. I was wondering if there was a equivalent C api for Get/Set variant attributes? cviauto.h has many variant related functions that work well for manipulating data inside the variant but i can't seem to access the attributes.
-
One of my minions is working thought the online Core3 course and showed me some code that made no sense to me. I am wondering it this is a bug or some little known feature. In the code, he was told to wire a variant to the 'variant to data' function and wire in a path constant so the output would be a path. This was later wired to a function needing a path input. So far so good. But later in the same code (in a different case) he was instructed to do the same thing but this time there was no input to the 'variant to data' function to tell it what to cast the variant data to. But for some reason, the output was still a path and he could still wire it to another function that needed a path as input. Here is a screen grab of the magical code: So, what is going on here? Bug?
-
I've run into an interesting problem using the Open G variant library. When trying to extract a list of cluster element names from a cluster in an empty array of clusters in a cluster itself, I get the following error from the Open G "Get Cluster Element Names VI": An example VI showing the problem is attached. At first I thought the problem was due to the fact the array is empty, but asking for cluster names of an empty array of clusters that is not in a larger cluster completes without error. Any thoughts on the cause or solution to this problem? empty array of clusters problem.vi
-
Hi there! I've played around with a piece of my Programm where I have to create an array of clusters where a cluster has two emenents: a NAME and a VALUE for the specific name. I Would like to use something like the firt Screenshot as an Input (Bundle the Variables to a cluster). Then, inside the SubVI I would like to generate said Array of Clusters based on the Label of the Controls that I use as Inputs to the cluster. As a Result I would like to get something like this: The thing is that I can't seem to get the Data out of the Variant - On the Frontpanel, the indicator for the variant shows all the information I need... How do I get the Information out of there? Any Ideas?
-
Currently, saving a date/timestamp to a config file saves it like this: Time Stamp = "00000000ÍAm#ß~p0000000000" I'd much prefer they be formatted like: Time Stamp = "2013-02-13T16:17:39.873Z" I realize this may run into some localization issues, but I'm fine with defaulting to the ISO 8601 format (or, you could change the "float number format" terminal to a generic "format string" input, and have float/time format strings line-delimited). The code to do so already exists in "Format Variant Into String", it checks if a waveform is a datestamp type before writing. This just needs to be ported over to the "Write key (variant)" VI (and correspondingly, to the read VI as well).
-
What am I doing wrong? I'm using the JKI "Write INI Cluster__ogtk.vi" and "Read INI Cluster__ogkt.vi" and I can't read back what I wrote. First I "Set" and then "Get". When the "Get" state pushes to the "Variant to Data" I get an error 91 (variant doesn't match type input). Is my cluster too complex? Noticing that the type variant being written doesn't match the variant data being read. It's missing section names. Can I do any complexity cluster or must it be formatted in a specific manner? I saved the hierarchy in this zip so you can see the very JKI libs I'm using. JKI Cluster to INI issue.zip One responder in the JKI forum indicated no problem. Another surmised that the IMAQdx reference was causing the error. Thanks in advance, JF
-
Hi, I am working in a DLL to create a Labview component that runs some C code. I was using the Call Library Function, and I see it works to write external functions that get and set Labview data in/from the C code. But now, I would like to make it work with Variants, since I want to allow to wire any kind of data into my CLF Node. I have been using the Adapt to Type - Interface to Data option to be able to introspect the LabVIEW Data from my C code and get or set its value. I have been told that Variants are structured very similar to any other LabVIEW Type, so I should be able to use the Interface to Data option as well (with some minor changes in the code and maybe some casts). But the truth is that I cannot even try it since when I connect a Variant to the CLF Node, LabVIEW tells me: I guess this means that it is not going to be as easy as expected, probably having to do some tricks, workarounds, etc. but right now I do not have any idea on what to try or where to start with. I have been trying to look in the documentation, help and posts anything useful but I did not find anything. So, any help will be greatly appreciated. Thank you very much.
- 2 replies
-
- variant
- interfave to data
-
(and 1 more)
Tagged with: