Script functions reference > Script functions in alphabetical order > M > MsgCountId

MsgCountId
Syntax
MsgCountId(block);
block 
Description
Counts the number of instances of the specified block in the Message.
Returns
The number of blocks found.
Examples
In the following examples, the Message contains the blocks blkA, blkB, and blkC structured as shown in the figure below.Click to enlarge
Example 62
The following script returns the number of blkB blocks in the Message:
MsgCountId("blkB"); //Returns 4
 
Example 63
The following script returns the number of blkB blocks in the first instance of block blkA:
MsgCountId("blkA:1/blkB"); //Returns 2
 
Example 64
The following script sample includes a counter to specify the N:th instance of block blkA:
...
$counter = 1;
$blkBinA = MsgCountId("blkA:" + $counter + "/blkB");
$counter++;
...
 
OpenText StreamServe 5.6 Updated: 2013-03-01