Smart Package Robot 's Collection Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Arrays and Data-Structures > !Collections/Fast Arrays > Collection-Commands >

 Smart Package Robot 's Collection Commands

CGC. - Collection Get Count

Previous Top Next


MiniRobotLanguage (MRL)

 

CGC. - Command

Get Number of Elements in a specified Collection

 

 

Intention

 

CGC. stands for "Collection Get Count".

This command is designed to retrieve the current count of elements in a specified collection.

Understanding the size of a collection is fundamental for various operations, including loops, conditional statements, and when preparing data sets for processing or analysis.

 

 

Syntax

 

 

CGC.P1[|P2]

 

 

 

Parameter Explanation

 

P1 - The collection identifier, a numeric value that represents the target collection from which the count of elements is to be retrieved from 0 to 2048.*

P2 - The variable that will store the retrieved count of elements from the specified collection. If omitted TOS is used.

 

*Collection Type 1: "Word-Collections".

They are numbered from 0 to 1024.

 

Collection Type 2: "Checksum-Collections".

They are numbered from 1025 to 2048.

 

 

 

 

Example

 

'***********************************

' CGC.-Sample

'***********************************
DBP.Testing Collection Get Count.

 

' Initialize collection 0 and ensure it's empty

VAR.$$C00=0

CLC.$$C00

DBP.Collection 0 has been cleared.

 

' Add a few unique names to the collection

VAR.$$N10=John

ATC.$$C00|$$N10

VAR.$$N20=Jane

ATC.$$C00|$$N20

VAR.$$N30=Mike

ATC.$$C00|$$N30

DBP.John, Jane, and Mike added to collection 0.

 

' Retrieve the count of names in the collection

CGC.$$C00|$$CNT

DBP.Collection 0 currently contains $$CNT elements.

ENR.

 

 

' Expected output:

' "Collection 0 currently contains 3 elements."

 

clip1017

 

 

 

 

Remarks

 

-

 

 

Limitations:

Currently the Smart Package Robot supports 1025 Collections that are numbered from 0 to 1024 and Type 2 -"Checksum"-Collections from 1025 to 2048.

Type 1 Collections are groups of character strings that are separated by a null byte. Therefore Elements must never Contain a CHR(0) (Null-Byte).

Type 2 Collections will contain a 16 Byte Checksum of an Element and do not have any delimiter.

 

 

See also:

 

ATC. - Add to Collection

CFV. - Collection from Variable

CGC. - Collection Get Count

CLC. - Clear Collection

CTV. - Collection to Variable

JIU. - Jump if Unique

JNU. - Jump Not Unique

RFC. - Remove from Collection