Find_first_in_Column

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > TXT. Text-File Engine > CSV-Related Commands >

Find_first_in_Column

TXT.gdit

Previous Top Next


MiniRobotLanguage (MRL)

 

TXT.Fic

TXT.Find_first_in_Column
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:

 

clip0381

 

then you have in Column "L" a block of 3 Entries which are from Poland.

The TXT.Fic will find the most upper of these entries, starting from a given Start-Line.

 

' This is the short version of the Sample Script, the full version see below.

$$IND="L"

$$SEA="Poland"

$$STA=1

$$DEL=;

' We use Stadard Search Pattern

TXT.fic|$$IND|$$STA|$$SEA|$$DEL|w

VAR.$$RES=$$000

MBX.$$RES

ENR.

 

clip0382

 

Syntax

 

 

TXT.Fic|P1|P2[|P3][|P4][|P5]

TXT.Find_first_in_Column|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 Stadard Search Pattern

TXT.fic|$$IND|$$STA|$$SEA|$$DEL|w

VAR.$$RES=$$000

MBX.$$RES

'++++++++++++++++++++++++++++++++

'++++++++++++++++++++++++++++++++

' 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:

 

  TXT.Load Textfile

  TXT.Clear

  TXT.From_Var

  TXT.Load_pure_Text

  TXT.Get_pure_Text

  FIL.Generate numbered Name

  FIL.Move numbered File

  ATF - Append-to-File

  CFF. - Copy-From-File

  CTF - Copy-To-File

  COP. - Copy File

  TXT.Get_Filename

  TXT.Get_Lenght

  TXT.To_Var_and_Clear

  GLC. - Get-Line-Count

  TXT.Get_Line

  IEF. / NEF. - If - exist - File

  LFF - Line-From-File

  WFF. - Wait-For-File

  TXT.Set_Line_to