fhs.TagWindowEntry Class

Help Contents

Introduction

The fhs.TagWindowEntry Class allows a Configuration Macro to manage an entry in the Tag Window.

Class Definition

CLASS fhs.TagWindowEntry

    VAR
        Name : STRING;
        FullName : STRING;
        TypeName : STRING;
    END_VAR

    METHOD AddNewFolder : fhs.TagWindowEntry
    END_METHOD

    METHOD AddNewLinkedFolder : fhs.TagWindowEntry
        VAR_INPUT TagType : ANY_STRING; END_VAR
    END_METHOD

    METHOD AddNewTag : fhs.TagWindowEntry
        VAR_INPUT TagType : ANY_STRING; END_VAR
    END_METHOD

    METHOD AddNewTemplateFolder : fhs.TagWindowEntry
    END_METHOD

    METHOD DeleteTag
    END_METHOD

    METHOD FindTag : fhs.TagWindowEntry
        VAR_INPUT TagName : ANY_STRING; END_VAR
    END_METHOD

    METHOD RenameTag : fhs.TagWindowEntry
        VAR_INPUT NewName : ANY_STRING; END_VAR
    END_METHOD

    METHOD SetProperty : fhs.TagWindowEntry
        VAR_INPUT 
            PropertyName: ANY_STRING; 
            Value : ANY_ELEMENTARY;
        END_VAR
    END_METHOD

END_CLASS

Class Members

The fhs.TagWindowEntry class contains these members:

MemberDescription
AddNewFolder A method to add a new folder to this tag.
AddNewLinkedFolder A method to add a new folder to this tag. The new folder will be linked to an existing template folder.
AddNewTag A method to add a new tag to this tag.
AddNewTemplateFolder A method to add a new template folder to this tag.
DeleteTag A method to delete the tag.
FindTag A method to locate a child tag by its name.
FullName A property returning the full name of the tag.
Name A property returning the name of the tag.
SetProperty A method to set a property of this tag.
TypeName A property returning the type name of the tag.

Examples

  1. A function to reliably create a folder:
    Function FindCreateFolder : VARIANT
    Var_Input
    	ParentFolder : VARIANT;
    	FolderName : STRING;
    End_Var
    Var Tag : VARIANT; End_Var
    
    	Tag := ParentFolder.FindTag( FolderName );
    	If Tag = OBJECT#Nothing Then
    
    		(* Create the folder *)
    		Tag := ParentFolder.AddNewFolder();
    
    		(* Set the correct name *)
    		Tag.RenameTag( FolderName );
    	ElseIf Tag.TypeName <> 'TagFolder' Then
    
    		(* The tag exists, but it is not a folder *)
    		Tag.DeleteTag();
    
    		(* Create the folder *)
    		Tag := ParentFolder.AddNewFolder();
    
    		(* Set the correct name *)
    		Tag.RenameTag( FolderName );
    	End_If;
    
    	(* Return the folder *)
    	FindCreateFolder := Tag;
    End_Function
    
  2. A function to reliably create a tag:
    Function FindCreateTag: VARIANT
    Var_Input
    	ParentFolder : VARIANT;
    	TagName : STRING;
    	TagType : STRING;
    End_Var
    Var Tag : VARIANT; End_Var
    
    	Tag := ParentFolder.FindTag( TagName );
    	If Tag = OBJECT#Nothing Then
    
    		(* Create the tag *)
    		Tag := ParentFolder.AddNewTag( TagType );
    
    		(* Set the correct name *)
    		Tag.RenameTag( TagName );
    
    	ElseIf Tag.TypeName <> TagType Then
    
    		(* The tag exists, but it is not the correct tag type *)
    		Tag.DeleteTag();
    
    		(* Create the tag *)
    		Tag := ParentFolder.AddNewTag( TagType );
    
    		(* Set the correct name *)
    		Tag.RenameTag( TagName );
    	End_If;
    
    	(* Return the tag *)
    	FindCreateTag := Tag;
    End_Function
    
    
  3. Using the previous functions to create a folder and place tags in the folder
    Program Main
    Var
        TagWindow : VARIANT;
        RootTag, FolderTag, Tag : VARIANT;
    End_Var
    
        (* Create an instance of the tag window class *)
        TagWindow := SysCreateInstance( "fhs.TagWindow" );
    
        (* Get the database root tag *)
        RootTag := TagWindow.DatabaseRoot();
    
        (* Create a folder tag *)
        FolderTag := FindCreateFolder( RootTag, 'Test Folder' );
    
        (* Create an Internal Digital Tag in the new folder *)
        FindCreateTag( FolderTag, 'Digital 1', 'InternalDigital' );
    
        (* Create an Internal Analog Tag in the new folder *)
        FindCreateTag( FolderTag, 'Analog 1', 'InternalAnalog' );
    
    End_Program

Standards Compliance

The class fhs.TagWindowEntry is an extension to the IEC 61131-3 standard.

Further Information

Configuration Tool Macros

To learn how to automate configuration changes in the Configuration Tool.

Configuration Tool

To learn about the Configuration Tool.

Fernhill SCADA

For an overview of the Fernhill SCADA product suite.

Fernhill SCADA Server

For information on the runtime components of the Fernhill SCADA Server.

Glossary

For the meaning of terms used in Fernhill SCADA.