Table Of Contents

Accessing Class Data

Version:
Last Modified: September 25, 2017

Only methods on the Member List of a class can directly access and manipulate the value a class field contains. 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 can only create a VI for data member access after you add a field to the Data view.

  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 adhere to.
    Option Description
    Dynamic Dispatch The VI on a diagram that executes at run time depends on the class object that the VI accepts.
    Static Dispatch The VI functionality is the same for all class objects it accepts.
  6. If you want to use the Property Node to access class object data on the diagram, select the Make available through Property Nodes checkbox.
  7. If you want to include error handling as part of your VI, select the Include error handling terminals checkbox.
    spd-note-note
    Note  

    If you enable the Property Node to access class object data, error handling terminals are automatically enabled for the data access VI.

  8. Click OK. The new data member access VIs appear on the Member List of the class. They also appear within the class G Type document on the Project Files tab.
  9. Open the VI that is not on the Member List of the class.
  10. Add a data member access VI and a class object from the Project Files tab onto the diagram. 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.
  11. Wire the class object on the diagram to the class object input of the data access member VI to programmatically access the class object data.

Recently Viewed Topics