LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CNVGetNumberOfStructFields equivalent in LabVIEW?

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.

0 Kudos
Message 1 of 6
(2,743 Views)

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

 

Fred Visser -- SystemLink R&D -- National Instruments
0 Kudos
Message 2 of 6
(2,713 Views)

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

 


 

0 Kudos
Message 3 of 6
(2,701 Views)

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,

Fred Visser -- SystemLink R&D -- National Instruments
0 Kudos
Message 4 of 6
(2,693 Views)

How would I create an array of strings as a shared variable in C?

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

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,

Fred Visser -- SystemLink R&D -- National Instruments
0 Kudos
Message 6 of 6
(2,671 Views)