01-17-2007 07:06 PM
01-17-2007 09:17 PM - edited 01-17-2007 09:17 PM
Message Edited by tbd on 01-17-2007 09:20 PM
01-18-2007 12:38 AM
01-18-2007 10:18 AM
TBD, your last post is correct - I am looking for the variant's string, which would naturally include all of the varaiant's attributes, as well as the data formats. The use case goes something like this:
1. The server application builds up a variant in the normal way, converting data to a variant, and then attaching attributes using Set Attribute.
2. The server then obtains the variant string, and puts that string into the shared variable description (or what have you). Variant to String doesn't work becuase it strips out the attributes. Ditto Flattent ot XML. The various Flatten to String options don't work because they are not human-readable.
3. The client application obtains that string, and reinserts it into a variant (not using To Variant, as that will just make a long string with no attributes).
4. The client then uses the Get Attribute primitive to strip out any attributes of interest.
01-19-2007 01:55 AM - edited 01-19-2007 01:55 AM
Hi Allen,
First, thank you for your patience!
I had some tools left-over from a Database project and threw something together that, I think, serves as an example of what you want. This isn't to ignore what Altenbach said about the optimal solution being a native/no-code implementation!
It was only after starting this that I realized it's related to something I've been saving as a pet project - a Cluster-to-INI-file converter. XML just isn't friendly enough! BTW, to give credit where due, a key routine and data-type used here came from Jim Kring. Anyway, here goes...
?
Message Edited by tbd on 01-19-2007 01:58 AM
01-19-2007 10:52 AM
01-22-2007 02:33 AM - edited 01-22-2007 02:33 AM
Hi Allen,
While I'm happy to entertain, I didn't mean to imply that my pet-project actually existed - it was more of a virtual-pet. Maybe Franken-pet would be a better description of parsing arbitrarily complex cluster type-strings (and the re-building of the type would have been worse!).
The shame of having to admit this drove the effort to develop a real tool - a first-draft of a cluster-to-INI converter that uses LabVIEWs XML tools to do the hard part (decomposition of the Cluster). An INI to Cluster converter (another virtual pet) will convert INI to XML, then let the XML tool reassemble the cluster.
I have no use for this tool right now, but when the time comes, I'll probably tweak it to make some things a bit nicer. Like arrays of simple-types don't need to reflect name/type for every element.
Cheers!
Message Edited by Support on 01-24-2007 11:41 AM
01-22-2007 06:47 AM
01-22-2007 01:54 PM
@shoneill wrote:
I also worked on a tool like this before.
I (in all my innocence and stupidity) worked entirely with Object references and VI server to parse the input cluster. It was buggy (making sure all the references are properly closed for an arbitrarily complex cluster is a pure nightmare) and the values were written to the ACTUAL Control whose reference was passed to the sub-routine (Via the "Value" property). This also had the nice side-effect of making the whole thing Veeerrryyy slow.
Still, it worked and I was happy with it until I found the OpenG variant (pun intended).
It's a nice project to learn from, I think I know quite a lot about working with control references now. It's not likely to surpass the OpenG version though.
Now a scripted INI read routine with an arbitrarily complex cluster where the ACTUAL data type can be recreated as an output. Just picture it, tell LV "Here's my INI cluster, please read it for me" and then (After probably 10 minutes or so) you have the actual code for reading it....... Kind of like INImx really 😉
That would be cool.
I think I'll add a product feature request!
Shane
03-08-2007 03:00 AM