OpenSection

CAS ActiveX Methods
The OpenSection method opens a section in a taglist to allow tags from within the section to be queried.  The section to open is specified by a tag path, that can include a tag name, section index, or tag data.

LONG OpenSection(
  LONG TagList, // Taglist in which a section will be opened
  BSTR TagPath // Tag path to the section to open
)


Parameters:
TagList TagList in which a section will be opened.

TagPath
This TagPath... Returns this section TagList...
CONTENT_PART The first CONTENT_PART section in TagList.
USER_NAME="MIKE" The first USER_NAME section in TagList with tag data of "MIKE".
[0] The first section in TagList.  Use a variable for the index in a loop to access all of the sections in a taglist.  See example below.
[2]="MIKE" The third section in TagList with tag data of "MIKE".
USER_NAME[2] The third USER_NAME section in TagList.
USER_NAME[2]="MIKE" The third USER_NAME section in TagList with tag data of "MIKE".
MESSAGE_HANDLE[2]/CONTENT_PART    The first CONTENT_PART section in the third MESSAGE_HANDLE section in TagList.

Return Values:
Section taglist, which can only be used with read methods, such as GetTag or GetTagCount.  You must pass this taglist to CloseSection when you are done using it.

0x0000 = Unable to open section.


Example:
function GetReceivedMessages()
  {
  var Tl, Sl;
  var Msg = "";
  Tl = CAS.New();
  CAS.AddTag(Tl,"GET_Q_ENTRIES_INFO","");
  CAS.AddTag(Tl,"REGISTERED_NAME","Fred");
  CAS.AddTag(Tl,"REGISTERED_PASSWORD","");
  CAS.AddTag(Tl,"USER_NAME","User2");
  CAS.AddTag(Tl,"Q_ID","Q_ID_RECEIVED");
  Sl = CAS.CreateSection(Tl,"RESPONSE_INCLUDE_ONLY","");
   CAS.AddTag(Sl,"SUBMIT_TIME",0);
   CAS.AddTag(Sl,"MESSAGE_COMPLETION_CODE","");
   CAS.AddTag(Sl,"RECEIVER_CSID","");
   CAS.AddTag(Sl,"PAGE_COUNT","");
  CAS.CloseSection(Sl);
   
    // Get messages on this already open session
  Tl = CAS.Send(Instance,Tl);
  
  if ( CAS.GetTag(Tl,"STATUS_NUM",0) == 0 )
    {
      // The number of messages is in the root of the reply taglist
    QueueCount = CAS.GetTag(Tl,"NUMBER_OF_Q_ENTRIES",0);
    
      // Each message is in it's own MESSAGE_HANDLE section
    for (var index=0; index<QueueCount; index++)
      {
      var st;
      Sl = CAS.OpenSection(Tl,"MESSAGE_HANDLE[" + index + "]");
        st = new Date(parseInt(CAS.GetTag(Sl,"SUBMIT_TIME",0)));
        Msg += CAS.GetTag(Sl,"MESSAGE_HANDLE",0) + ",";
        Msg += st + ",";
        Msg += CAS.GetTag(Sl,"MESSAGE_COMPLETION_CODE",0) + ",";
        Msg += CAS.GetTag(Sl,"RECEIVER_CSID",0) + ",";
        Msg += CAS.GetTag(Sl,"PAGE_COUNT",0) + "\r\n";
      CAS.CloseSection(Sl);
      }
    }
  else
    {
      // Return the error
    Msg = CAS.GetTag(Tl,"STATUS",0);
    }
  CAS.Delete(Tl);
  return(Msg);
  }

 

See Also:
CAS CreateSection, CAS CloseSection, CAS GetSectionCount, CAS GetTag