|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Arrays and Data-Structures > LST. - List Arrays > List-Operations > Smart Package Robot (SPR) List Commands |
MiniRobotLanguage (MRL)
LST.InsNext
Insert a value after a node in a list
Intention
The LST.InsNext command inserts a new value after a specified node in a list. This is useful when you need to add data at a specific position in the list without overwriting existing elements.
The command requires the list handle (`$$LST`), the handle of the reference node (`$$NOD`), and the value (`$$VAL`) to insert. The new node will be placed immediately after the reference node.
Syntax
LST.InsNext|$$LST|$$NOD|$$VAL
Parameter Explanation
$$LST - The list identifier, typically a numeric value or a variable that contains a valid list handle.
$$NOD - The handle of the reference node after which the new value will be inserted.
$$VAL - The value to insert after the reference node.
Example
'***********************************
' LST.InsNext Sample Script
'***********************************
' Create a new list
LST.New|$$LST
' Add elements to the list
LST.Add|$$LST|Hello
' Get the first node
LST.First|$$LST|$$NOD
' Insert a value after the first node
LST.InsNext|$$LST|$$NOD|World
' Verify the insertion
LST.Next|$$NOD|$$NOD
LST.Get|$$LST|$$NOD|$$VAL
DBP. Value of the second node: $$VAL
' Clean up
LST.End|$$LST
ENR.
Remarks
-
Limitations:
- The list must be initialized and contain at least one node.
- The reference node handle must be valid.
See also:
• LST.InsPrev - Insert Value Before a Node