Applies To:
  • CitectSCADA 3.00

Summary:
Question: How can I test if a tag exists from Citect runtime?

Solution:
In version 3.x and later you can use the TagInfo() function to get information about each tag in the database. You can also use this function to check if a tag exists as follows:

INT
FUNCTION
   TagExist(STRING sName)
   INT bExist;
   ErrSet(1);
   TagInfo(sName, 0);
   IF IsError() THEN
      bExist = FALSE;
   ELSE
      bExist = TRUE;
   END
   ErrSet(0);
   return bExist;
END

You need to use ErrSet() to stop a hardware error from begin generated when you call TagInfo() with the invalid tag name.

 

Keywords:
 

Attachments