GetTag

CAS ActiveX Methods

The GetTag method retrieves the data for a specific tag in a taglist. This method will not descend into the sections of a taglist.  To access a tag in a section, you must call OpenSection and pass the section taglist to GetTag.

BSTR GetTag(
  LONG TagList, // Taglist to query
  BSTR TagName, // Name of tag to retrieve
  LONG TagIndex // Index of tag to retrieve
)


Parameters:
TagList Taglist to be queried for the desired tag.

TagName
Value Meaning
"" Retrieve any CAS tag
"<tag name>" Specific tag name to retrieve

TagIndex When multiple tags matching the specified TagName exist, the TagIndex is used to specify which occurrence of the tag should be retrieved.

Return Values:
Tag data, as a string.  All tag data is returned in the form of a string, even if the data type for a tag is numeric.  If the return value is required in numeric form, include a call to a conversion function, for example, TagData = parseInt(CAS.GetTag(Tl,"<tag name>",0)).

Example:
function LogOn()
 {
 var CAS_instance;

   // Get access to CAS interface and open an instance

 if (CAS = new ActiveXObject("CASX.CAS"))
   {  
   if (CAS_instance = CAS.Open(0,"",0)) 
     {
     var Tl, UniqueName, StatusNum;

       // Logon to the connection router
        
     Tl = CAS.New();
     CAS.AddTag(Tl,"LOGON","");
     UniqueName = "XYZ-"+parseInt(Math.random()*1000000+1000000);
     CAS.AddTag(Tl,"LOGON_NAME",UniqueName);
     CAS.AddTag(Tl,"DOMAIN_NAME","\\\\CASDEV\\NETSATISFAXTION");
     CAS.AddTag(Tl,"PROTOCOL",2); // IP

       // Send taglist to CAS driver, to logon to domain

     Tl = CAS.Send(CAS_instance,Tl);
     StatusNum = parseInt(CAS.GetTag(Tl,"STATUS_NUM",0));
     CAS.Delete(Tl);
      
     if (StatusNum == 0)
       {
       return(
CAS_instance);
       }
        
     CAS.Close(CAS_instance);
     }
    
   delete CAS;
   }

 return(null);
 }

See Also:
CAS New, CAS AddTag, CAS OpenSection, CAS Send