$collSize
Get the number of Struct nodes in the collection.
Struct->$collSize
Return Values
The value returned by $collSize depends on whether Struct refers to a single Struct or to multiple Structs.
Return Value |
Meaning |
---|---|
> |
Number of members in the collection |
|
StructVariable refers to a single Struct node or a Struct leaf |
|
StructVariable does not refer to a Struct |
Value |
Error Constant |
Meaning |
---|---|---|
|
|
Struct member not found |
|
|
Not a valid struct member type |
Description
The $collSize function is intended for use with a struct variable or parameter that refers to multiple Structs. If it refers to only a one Struct, you can use the $memberCount Struct function. In this case, the expression StructVariable->$memberCount evaluates to the same value as StructVariable->*->$collSize.
Using the Collection Size
The collection size can be used when you need to iteratively process the members of a Struct. For example:
vTotalStructs = pStruct->$collsize if (vTotalStructs > 1) i = 1 while (i <= vTotalStructs) ;do something i = i + 1 endwhile else ;do something else endif
Version |
Change |
---|---|
9.5.01 |
Introduced |
9.6.02 |
Can return a value of |