Table Of Contents

Transferring Data Using Tags

Version:
    Last Modified: March 29, 2019

    Use Tags nodes to send and receive measurement data from one system to other systems, servers, or web browsers.

    What to Use

    What to Do

    1. Create the following diagram in a VI to read tag data.

      Customize the gray sections for your unique programming goals.

      The Open Configuration node initiates a connection with a web server. Refer to the Details tab of the Open Configuration (User) or the Open Configuration (API Key) nodes for help connecting to a server.
      The Open Tag node opens a reference to a tag on the server defined by the configuration.
      spd-note-note
      Note  

      Use the Query Tags node instead of Open Tag if you do not know the data type of the tag.

      If the reference does not exist on the server, the node will create one. Open Tag will return an error if a tag with the same path but of a different data type already exists.

      Use a For Loop to open a tag for each element in an array of tag names. In this example, the node opens an array of station temperature tags.

      The Read Tag node checks the current value of the tag. Follow an open/read/close model when using this node.
      spd-note-note
      Note  

      Use the Multi Read node instead of Read Tag if you need to read multiple tag values as a part of a single operation.

      Use a While Loop to continue reading tags until a condition is met. In this example, the node reads tags unless the boolean constant changes to True.

      Use a Case Structure to set up conditions for when to read a tag. In this example, the node reads all tags unless the Site control is -1. If the Site control is -1, a default temperature value passes on to the rest of the program.

      The Close Tag node closes a tag reference.

      Use a For Loop to close tags from an array of tag names. To simplify your code by not using a For Loop, select Multiple as your Function Configuration.

      The Close Configuration node cleans up connections associated with the configuration by invalidating any open references to created objects.
    2. Create the following diagram in a VI to write a tag value.

      Customize the gray sections for your unique programming goals.

      The Open Configuration node initiates a connection with a web server. Refer to the Details tab of the Open Configuration (User) or the Open Configuration (API Key) nodes for help connecting to a server.
      The Open Tag node opens a reference to a tag on the server defined by the configuration.
      spd-note-note
      Note  

      Use the Query Tags node instead of Open Tag if you do not know the data type of the tag.

      If the reference does not exist on the server, the node will create one. Open Tag will return an error if a tag with the same path but of a different data type already exists.

      Use a For Loop to open a tag for each element in an array of tag names. In this example, the node opens an array of station temperature tags.

      The Write Tag node writes a value to a tag. Follow an open/write/close model when using this node.
      spd-note-note
      Note  

      Use the Multi Write node instead of Write Tag if you need to write multiple tag values as a part of a single operation.

      If you want the server to manage the time stamp of when the tag was written, leave the time stamp cluster unwired.

      Use a While Loop to continue reading tags until a condition is met. In this example, the node writes tags until you click the stop button on the panel.

      Use a For Loop to write a tag for each element in an array of tag names.

      The Close Tag node closes a tag reference.

      Use a For Loop to close tags from an array of tag names. To simplify your code by not using a For Loop, select Multiple as your Function Configuration.

      The Close Configuration node cleans up connections associated with the configuration by invalidating any open references to created objects.

    Troubleshooting

    If you encounter errors, try the following troubleshooting strategy:
    • Make sure the Function configuration of the node matches the data type of the tag. For instance, if the data type of the tag called from the server is a double-precision, floating point number, select Double as your Function configuration.

    Recently Viewed Topics