|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > String commands > !BLO.-Block-Commands > Block Information > String Operations |
MiniRobotLanguage (MRL)
BLO.Verify
Verifies expected block count and retrieves the last block.

Intention
This Command verifies that a string contains an expected number of blocks before extracting the last one. It is essential for robust parsing when you need to ensure data integrity before processing.
If the actual count does not match expectations, you can optionally allow the operation to succeed if there are more blocks than expected (flexible matching).
Syntax
BLO.Verify|P1|P2|P3|P4|P5|P6[|P7]
Parameter Explanation
•P1 - (Input, Text) The source string to analyze.
•P2 - (Input, Text) The starting delimiter string.
•P3 - (Input, Text) The ending delimiter string.
•P4 - (Input, Numeric) The expected number of blocks.
•P5 - (Input, Numeric) Allow exceed flag: 0=exact match required, 1=more blocks OK.
•P6 - (Output, Text) Variable to store the last block if verification succeeds.
•P7 - (Optional Output, Numeric) Variable to receive the actual block count.
Verifying Block Count
Source: "[ITEM]A[/ITEM][ITEM]B[/ITEM][ITEM]C[/ITEM]"
Expected: 3 blocks
Allow exceed: 0 (exact match)
Result: Returns "[ITEM]C[/ITEM]" (last block)
Source: "[ITEM]A[/ITEM][ITEM]B[/ITEM]"
Expected: 3 blocks
Allow exceed: 0
Result: Empty string (verification failed)
Example
'***********************************
' BLO.Verify Example
'***********************************
$$DATA="[REC]Record1[/REC][REC]Record2[/REC][REC]Record3[/REC]"
' Expect exactly 3 records, get the last one
BLO.Verify|$$DATA|[REC]|[/REC]|3|0|$$LAST|$$ACTUAL
' $$LAST = "[REC]Record3[/REC]"
' $$ACTUAL = 3
' Allow more than expected (flexible matching)
$$MORE="[X]1[/X][X]2[/X][X]3[/X][X]4[/X]"
BLO.Verify|$$MORE|[X]|[/X]|2|1|$$RESULT|$$CNT
' $$RESULT = "[X]4[/X]" (last block)
' $$CNT = 4 (actual count)
MBX.Found $$CNT blocks, last is: $$RESULT
ENR.
Remarks
• If verification fails (count mismatch), P6 receives an empty string.
• Use P7 (actual count) to diagnose why verification failed.
• With AllowExceed=1, the function succeeds if actual >= expected count.
• Always returns the LAST block on success, not the Nth block.
See also:
• BLO.VerifyContent - Verify and get content only
• BLO.Count - Count blocks without verification
• BLO.Validate - Check delimiter balance