System Projects Reference > The Library Controls Include Project > Use the Library Controls > Use the Tag Table Genie
Using the Tag Table Genie

Use the Tag Table Genie on a page when you want to be able to view variable tags where the value of each tag changes constantly within your project.

The table does not automatically populate with variable tags unless a Cicode function is called to add the tags to it. The Cicode function to add variable tag to the table is:

LibTagTable_AddTag(STRING sTable, STRING sTag)

Example 1: Populating the table with a button

  1. From the Object toolbox select -> The Paste Genie icon.
  2. In the Paste Genie window select the lib_controls library
  3. Select the Tag Table genie. The tag Table genie is pasted onto the graphics page.
  4. In the Tag Table Genie property dialog configure the following fields:

    Parameter

    Description

    TagTable Name

    Tags

    Width

    300 ( all columns within the table are displayed. If left at 100 the value column is not displayed)

    Number of rows

    20

    Header Height

    18

    Row Height

    15

    Header Padding

    5

    Row Padding

    4

    Column Padding

    5

    Horizontal Scrollbar

     

    Vertical Scrollbar

    Verbar (name of horizontal scroll bar placed on current page)

  5. Click OK to save the changes
  6. Paste the Vertical Scrollbar genie onto the graphics page. Position where the width of the table might end.In the 'Library_Control - Scrollbar' dialog:
  7. Parameter

    Description

    Scrollbar Name

    Verbar

    Height

    100

    Update on Drag

    True (default)

    Allow double-click

    True (default)

    Auto Hide

    False (default)

    Hidden When

    False (default)

  8. Click OK to save the changes
  9. From the Object toolbox select the 'Button'object
  10. Draw a button onto the page and configure as follows:
  11. Action

    Up

    Up Command

    LibTagTable_AddTag("VariableTags","Bit_1")

  12. Click OK to save the changes
  13. Compile and Run the project.
  14. At runtime open the example page and click on the 'VariableTag' button
  15. The table will refresh and the Bit_1 tag and corresponding value will be displayed.

Variations of the example include:

 

Example 2: Initialized Cicode function in table configuration

  1. Using the Cicode sample below, open the Cicode Editor and create a function.
  2. Example: 'MyTagTableInitialze' initialization function:

    
    	INT FUNCTION MyTagTableInitialize(STRING sTable)
    		INT hSession;
    		STRING sCluster;
    		STRING sTag;
    		INT nError;
    
    		// Add all variable tags to the tag table
    		hSession = TagBrowseOpen("", "Cluster,Tag", "Cluster:A,Tag:A", "");
    		nError = TagBrowseFirst(hSession);
    		WHILE (nError = 0) DO
    			sCluster = TagBrowseGetField(hSession, "Cluster");
    			sTag = TagBrowseGetField(hSession, "Tag");
    			LibTagTable_AddTag(sTable, sCluster + "." + sTag);
    			nError = TagBrowseNext(hSession);
    		END
    		IsError();
    		TagBrowseClose(hSession);
    
    		// Tell the tag table initialization is completed
    		RETURN TRUE;
    	END
    
    				

    Save the Cicode file.

  3. As in example 1 add the Tag table library control and Vertical scroll bar to the graphics page.
  4. In the Tag Table Genie property dialog configure the following fields:

    Parameter

    Description

    TagTable Name

    Tags

    Width

    300 ( all columns within the table are displayed. If left at 100 the value column is not displayed)

    Number of rows

    20

    Header Height

    18

    Row Height

    15

    Header Padding

    5

    Row Padding

    4

    Column Padding

    5

    Horizontal Scrollbar

     

    Vertical Scrollbar

    Verbar (name of horizontal scroll bar placed on current page)

    Initialze

    MyTagTableInitialize("#Name")

  5. Click OK to save the changes
  6. Paste the Vertical Scrollbar genie onto the graphics page. Position where the width of the table might end.In the 'Library_Control - Scrollbar' dialog:
  7. Parameter

    Description

    Scrollbar Name

    Verbar

    Height

    100

    Update on Drag

    True (default)

    Allow double-click

    True (default)

    Auto Hide

    False (default)

    Hidden When

    False (default)

  8. Click OK to save the changes.
  9. Compile and then run the project.

At runtime the table will look like the following:

See Also

Published June 2018