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

ATC.Add to Collection

Previous Top Next


MiniRobotLanguage (MRL)

 

ATC.Add to Collection

Add Element to Collection

 

 

Intention

 

The ATC. command is the "Add if unique" Command for collections.

It adds a new element to a collection only if that element doesn't already exist in the collection, preventing duplicates.

 

Currently the Smart Package Robot supports 1025 Collections that are numbered from 0 to 1024.

 

Please read the general information about Collections and Fast Arrays.  

 

A Collection can be used to make sure that you do not process the same data multiple times.

 

ATC. will not add the same element multiple times to the same Collection.

 

Sample:

FOR.$$LC3|1|5

  TST.Generate PreName|$$NAM

  CGC.0|$$NUA

  DBP.Bevore: $$NUA adding: $$NAM

  ATC.0|$$NAM

  CGC.0|$$NUM

  DBP.After: $$NUM

  IVV.$$NUA=$$NUM

    DBP.$$NAM not added (is already in Collection).

  EIF.

NEX.

ENR.

 

Result:

 

[16:33:53] Bevore: 0 adding: Maximilian

[16:33:53] After: 1

[16:33:53] Bevore: 1 adding: Maximilian

[16:33:53] After: 1

[16:33:53] Maximilian not added (is already in Collection).

[16:33:53] Bevore: 1 adding: Lanerenara

[16:33:53] After: 2

[16:33:53] Bevore: 2 adding: Helenais

[16:33:53] After: 3

[16:33:53] Bevore: 3 adding: Benjamonix

[16:33:53] After: 4

 

Normally  you can use JNU. - Jump if not unique to check if an Element is already in a Collection or not.

 

Sample:

 

TST.Generate PreName|$$NAM

FOR.$$LC3|1|3  

  CGC.0|$$NUA

  DBP.Bevore: $$NUA adding: $$NAM

  JNU.0|$$NAM|over

  ATC.0|$$NAM

  CGC.0|$$NUM

  DBP.After: $$NUM

  IVV.$$NUA=$$NUM

    DBP.$$NAM not added (is already in Collection).

  EIF.

  :over  

NEX.

ENR.

 

Result:

 

[17:14:17] Bevore: 0 adding: Lukaston

[17:14:17] After: 1

[17:14:17] Bevore: 1 adding: Lukaston

[17:14:17] Bevore: 1 adding: Lukaston

 

 

Syntax

 

 

ATC.P1|P2[|P3]

 

 

Parameter Explanation

 

 

P1 - The collection identifier, typically a numeric value or a variable that contains a number from 0 to 1024/1025 to 2048.*

P2 - The element or "word" to be added to the collection. P2 can contain any characters.

P3 -  (optional) The element can be treated as:

  "f" - floating point number with a range of approximately +/- 3.4*10^-4932 to 1.2*10^4932, and offer 18 digits of precision

  "i" - 64-bit Integer number with a range of -9.22x10^18 to 9.22x10^18 ( -2^63 to 2^63 -1)

  "t" - Trim String before store.

  "l" - Lower-Case-Trim String before store.

  "u" - Upper-Case-Trim String before store.

 You need to use the "f" and "i" options also when you take the Elements out of the Array / Collection if you used them to put the elements in.

 You do not need to use the "t","l" and "u" option two times. You can use them either when you fill the Array or when you take things out.

 If you do not specify P3, the item is treated as String (Text).

 

*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

 

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

' ATC.-Sample

'***********************************
' This will reset the Collection "0"

CLC.0

' Now we add the Element Heinz" to the Collection

$$NEW=Heinz

ATC.0|$$NEW

 

CGC.0|$$NUM

DBP.Collection 0 contains $$NUM Elements.

 

CGC.1|$$NUM

DBP.Collection 1 contains $$NUM Elements.

ENR.

 

 

 

Remarks

 

-

 

 

Limitations:

-

 

 

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