10-22-2010 07:34 PM
Is there an equivelent to the CVI function CNVGetNumberOfStructFields in LabVIEW? I'm trying to pass network variables to/from a CVI application and a LabVIEW GUI, but this has me stuck.
10-25-2010 12:59 PM - edited 10-25-2010 01:02 PM
Hi Kaveh,
There doesn't appear to be a directly equivalent LabVIEW function (or Property node) for the CNVGetNumberOfStructFields function. Have you had any issues using the Shared Variable Read Variable VI directly? The Shared Variable VI should abstract the lower level calls, and handle them for you.
Try it with this example.
Programmatically Reading Shared Variables Using URL and Read Variable
10-25-2010 01:14 PM
Hi Fred,
I can read variables directly, the problem is that I cannot find a way to read in a shared variable struct in labview the same way that I can with CVI. In my CVI application, I dynamically size my shared variable to exactly the number of strings I need, but I can't figure out what that number is in LabVIEW (like I could with CVI) and programatically create a struct/cluster to type the shared variable with. Any insight on how to do this?
-Kaveh
@F Visser wrote:
Hi Kaveh,
There doesn't appear to be a directly equivalent LabVIEW function (or Property node) for the CNVGetNumberOfStructFields function. Have you had any issues using the Shared Variable Read Variable VI directly? The Shared Variable VI should abstract the lower level calls, and handle them for you.
Try it with this example.
Programmatically Reading Shared Variables Using URL and Read Variable
10-26-2010 12:43 PM
Hi Kaveh,
So to clarify, you have a struct of strings, and the number of strings in that struct varies at runtime? Since Shared Variables don't support clusters, and LabVIEW doesn't appear to be able to handle C style structs directly, would you be able to change the architecture of the CVI program? Could you store these strings in separate Shared Variables, or as an array of strings?
All the best,
10-26-2010 12:44 PM
How would I create an array of strings as a shared variable in C?
10-27-2010 08:17 AM
Hi Kaveh,
The CVI function CNVCreateArrayDataValue will take an array of strings and convert it to network variable data.
CVI Help Article
http://zone.ni.com/reference/en-XX/help/370051P-01/cvi/libref/cvicnvcreatearraydatavalue/
Hope this helps,