Transfer Array Data to a SystemLink™ WebVI in LabVIEW NXG

Updated Dec 4, 2019

Reported In

Software

  • LabVIEW NXG
  • LabVIEW NXG Web Module
  • SystemLink Cloud

Issue Details

  • How can I transfer an array of data to a WebVI using SystemLink™ functions?
  • The SystemLink™ Write Node won't accept an array input. How can I write an array to the WebVI?
  • Is there a SystemLink™ function that accepts array data as an input?
  • I'm using LabVIEW NXG to publish a WebVI to SystemLink™ Cloud. Is there a way to send array data between the VIs?

Solution

The SystemLink™ Write and Read Tags do not accept arrays as a valid input. Only single elements can be accepted.
Arrays can be transferred to a WebVI by indexing the array and writing a single element at a time.


Writing Arrays

In order to write an array of data, each element should be written one at a time by indexing the array in a While Loop.
In the below snippet, the array element is incremented for each iteration of the loop.

This snippet can be used as a SubVI that is called in a For Loop to Write a single element per iteration. The attached ZIP file contains an example of this.



This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.


Reading Arrays

To read the array data in the WebVI, a Read Tag can be wired directly to the Open Tag. This is shown in the below snippet.


This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

An example project that implements this functionality is attached to this article.

Additional Information

See WebVIs: Moving Data Across your Applications for a further explanation of how to transfer data to a WebVI using the attached example project.