LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Creating Clusters

Hello, I have two questions that kind of go hand in hand.  

First: Is it possible to GET xml data from a URL in LabVIEW?

Second: If it is, is it possible to do this dynamically?

I have attached an example xml file that I wish to get.  But I also wish (wishing pretty hard here) that it's possible to create clusters dynamically.  I know this is a stretch cuz how in the world could I possibly program the rest of app without knowing the exact data types.  Really, I'm just looking to display data.  Get the data and display it.  But after typing the question, pretty sure I answered it myself.  Who knows, maybe there's a genius out there who came up with something awesome willing to help me out.

0 Kudos
Message 1 of 5
(6,446 Views)

I foudn the following white paper.  Is this what I'm looking for.  Seems like it could do the trick in terms of getting the xml from the URL.

 

http://digital.ni.com/public.nsf/allkb/89171CEC879A70A3862572950057ACC6

0 Kudos
Message 2 of 5
(6,441 Views)

Cool, answered my first question with the following:

 

http://digital.ni.com/public.nsf/allkb/27272FE3A32C334286257612004D9153

 

Any possible answers to the second question....like, "no."

0 Kudos
Message 3 of 5
(6,422 Views)

You cannot dynamically create a cluster. However, you can dynamically create a tree of LabVIEW objects, and then display the data by traversing that tree. The JSON LabVIEW library provides an example of this - it can accept arbitrary JSON text, parse out the datatypes, and "pretty-print" that data. I don't know of something similar in LabVIEW for XML, but it might be out there.

Message 4 of 5
(6,408 Views)

Could you do something like parse the XML and save the components as an Array of Variants?  To display it, you could read the Variant, deduce its type, and display it as appropriate.  Alternatively, you could skip the Variant part and as you read it, save it in a suitable-for-display string representation.  Crude, but it might get the job done.

 

I recently wanted to create a Cluster based on what I hoped would be "rarely-changing" data, in this case, the structure of an Excel Workbook being used to control a set of tests (with about 100 parameters per test).  I decided to have my "test variable" be a Cluster, but didn't particularly want to build the thing by hand.  This was my first foray into scripting, but I managed to pull it off.  This came in very handy when (as inevitably happens) someone said "Can we add just three more parameters to the Workbook?".  Fortunately, I could just re-run the script, create the new TypeDef, then only worry about programming for the "new" elements of the Cluster.

 

I was thinking that if you scripted a Cluster and could (at Run Time) use it in some code (say, through VI Server), you might be able to boot-strap this operation.  But then I realized you'd have to script the code to use the (unknown) elements of the Cluster, as well ...

 

BS

0 Kudos
Message 5 of 5
(6,367 Views)