Table Of Contents

Accessing Class Data

Last Modified: August 6, 2018

Only methods on the class member list can directly access and manipulate a class field value. However, you can create data member access VIs that you can use to access class object data in a VI that is not on the Member List of the class.

Complete the following steps to create read and write access member VIs for a field on the Data view of a class G Type document.
  1. Open the class G Type document and switch to the split view or Member List view of the G Type document editor.
  2. Click Add member»VI for data member access...
    spd-note-note
    Note  

    You must add a field to the Data view before you can create a VI for data member access.

  3. Select the field the VI can access.
  4. Select the type of Access you want the VI to have.
    Option Description
    Read Creates a VI that can only read the value of the class field.
    Write Creates a VI that can only write a new value to the class field.
    Read and Write Creates one read VI and one write VI.
  5. Select the Call Behavior you want the VI to exhibit.
    Option Description
    Dynamic Dispatch The VI that executes at run time depends on what class object the VI accepts.
    Static Dispatch The VI functionality is the same for all class objects it accepts.
  6. To use the Property Node to access class object data on the diagram, select the Make available through Property Nodes checkbox.
  7. To include error handling as part of your VI, select the Include error handling terminals checkbox.
    spd-note-note
    Note  

    Enabling the Property Node to access class object data automatically enables error handling terminals for the data access VI.

  8. Click OK. The new data member access VIs appear on the class member list. They also appear within the class G Type document on the Project Files tab.
  9. Open the VI that is not on the class member list.
  10. Add a data member access VI and a class object from the Project Files tab onto the diagram.
  11. To programmatically access the class object data, wire the class object on the diagram to the class object input of the data access member VI. If you selected Make available through Property Nodes when creating the data member access VI, you can wire the class object to a property node on the diagram to access class object data.

Recently Viewed Topics