<< Click to Display Table of Contents >> Navigation: 3. Script Language > Variable Definitions and Operations > Data-Block Commands > Data-Block Commands |
MiniRobotLanguage (MRL)
SBE. Command
Set Block Element
Intention
This command can be used to Set individual elements of an data-block.
Using SBE. you can selectively Set individual data-items to an value you like.
Usage of GBE. is simple, see this example:
' Create a block with 3 elements
CNB.$$BLO|3|Element 1|Element 2|Element 3
' retrieve element Nr.1 into $$RES
GBE.$$BLO|1|$$RES
' Debug-Print the element in the editor
DBP.$$RES
ENR.
For more details on 1.5.1.5. Organizing data items in blocks see there.
Syntax
SBE.P1|P2[|P3]
Parameter Explanation
SBE.P1|P2
In this case P1 is taken as Block-variable, P2 is the number of the block-element (1-based) to get whatever is on TOS. If TOS evaluates empty, the element will be set to empty.
P2 - If P2 is higher then the actual number of blocks in data-block P1, then the data-block is automatically extended to that number of blocks.
SBE.P1|P2|P3
In this case P1 is taken as Block-variable. P2 is the number of the block-element (1-based) which is going to be filled with the content from variable P3.
Example
'**********************************************
' SBE./CNB. - Sample
'**********************************************
CNB.$$BLO|6000
FOR.$$CNT|1|6000
VAR.$$ELE=Data-Item $$CNT
SBE.$$BLO|$$CNT|$$ELE
NEX.
' Now see if they are really in there
FOR.$$CNT|1|6000
GBE.$$BLO|$$CNT|$$ELE
PRT. ELement $$CNT=>$$ELE
NEX.
ENR.
Remarks
Blocks are internally checked for authenticity. This is done to prevent hard to track error.
If you change bytes or the length of a block variable externally, the block will not be unpacked anymore.
Data blocks can contain all 256 ASC Characters (even binary files) and are binary-compatible. Therefore whether special folders nor system variables are resolved inside blocks. Variables are resolved one time.
Limitations:
There is no explicit limit on data-items per block. However timing considerations may set you a limit at around 10000 Items, depending on your available hardware. For a larger number of non-binary items, Member-Operations, using SBD. FEM. and SBM. may be significantly faster.
See also:
• 1.5.1.5. Organizing data items in blocks