|
|
|||||||||||||||||||||
|
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.
|
|||||||||||||||||||||
|
Parameters: |
|||||||||||||||||||||
|
|||||||||||||||||||||
|
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 | |||||||||||||||||||||
|
|