<< Click to Display Table of Contents >> Navigation: 3. Script Language > TXT. Text-File Engine > CSV-Related Commands > Get_Column_Block |
MiniRobotLanguage (MRL)
TXT.Gcb
TXT.Get_Column_Block
Find the first Entry in a specified column with a specified value.
Intention
This command is useful if you have to do with csv-files.
Most often this can be used after you have sorted the csv-File.
After Sorting, you want a complete Block of Entried. For example, if you have this File:
then you have in Column "L" a block of 3 Entries which are from Poland.
The TXT.gcb will give you the complete Block from the first to the last found entry with the given Specifications.
' This is the short version of the Sample Script, the full version see below.
$$IND="L"
$$SEA="Poland"
$$STA=1
$$DEL=;
' We use Standard Search Pattern
TXT.gcb|$$IND|$$STA|$$SEA|$$DEL|w
Syntax
TXT.Gcb|P1|P2[|P3][|P4][|P5]
TXT.Get_Column_Block|P1|P2[|P3][|P4][|P5]
Parameter Explanation
P1 - (Input) Variable with Index of item to get. Can also be a List of Items to get. The List can contain whether the Column-Number or the Letter in "".
Can be "C" or "AA" - must be a Single Item.
P2 - (Input) Variable with Startline, default is 2 (to skip an Header).
P3 - (Input) Variable with one or more Words to compare to. These must be quoted and separated with ",".
Example: "Headline","Party","Column"
P4 - (Input) Delimiter, if omitted Semicolon is used.
P5 - (Input) Flag, can be any of these: "p" (default) - normal compare, "w" - compare using SPR-Standard-Search Patterns,
"e" - Equalcase Compare, "c" - contains, "ce" - contains equalcase
Example
'*****************************************************
'
'*****************************************************
$$TMA=#dtime#
IEM.
VAR.$$FIA=$cmdexe$
ELS.
VAR.$$FIA=?exeloc\Sources\Blocktest.CSV
EIF.
VAR.$$OUF=?exeloc\Result_#date#.csv
NEF.$$FIA
$$ERR=Die Quelldatei: $$FIA$crlf$existiert nicht.
GTO.ero
EIF.
'-----------------------------------------------------------
TXT.Load_Textfile|$$FIA|$$LIC
' Convert $LF to $crlf$ if needed.
'TXT.lfp
TXT.Get_Line_Count|$$LIC
IVV.$$LIC<5
$$ERR=File is empty?
GTO.ero
EIF.
PRT.$$LIC Lines loaded.
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
' Place your Script here
$$IND="L"
$$SEA="Poland"
$$STA=1
$$DEL=;
' We use Standard Search Pattern
TXT.gcb|$$IND|$$STA|$$SEA|$$DEL|w
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
' These lines process and save the result.
'TXT.lfr
TXT.Save_File|$$OUF
EXO.$$OUF
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
:enx
CAL.$$TMA=#dsince#*1000|i
IVV.$$TMA>1100
CAL.$$TMA=$$$TMA/1000
$$TXT=Programm wird beendet nach $$TMA Sekunden.
ELS.
$$TXT=Programm wird beendet nach $$TMA ms.
EIF.
MBT.$$TXT|Programm Ende|9|32
ENR.
'-----------------------------------------------------------
:ero
PRT.$$ERR
GTO.enx
'#######################################################################
Remarks
-
Limitations:
-
See also:
• IEF. / NEF. - If - exist - File