Commands & Syntax > Commands > File Mainpulation >

CSV Get Record Fields - < csv_get_record >() ... [Pro]

www.perfectkeyboard.com

 

File CSV Get Record Fields
<csv_get_record>(File handle variable,Variable array for fields,Variable for number of fields)
Available in: Professional edition

This command retrieves one record from CSV file. Call the command multiple times in order to read all records.

Note: CSV (comma separated value) file is a textual file consisting of multiple rows (records) where on each row there are multiple entries (fields) separated by comma:
Read more here: https://en.wikipedia.org/wiki/Comma-separated_values

 

#

Parameter name

Parameter description

1

File handle variable

Variable containing CSV file handle obtained by "CSV load data" command.

2

Variable array for fields

Variable array that receives fields for the current record.

3

Variable for number of fields

Variable that receives number of fields obtained. If this value is 0 then no more data is in the CSV file.

 

Example (Macro Steps):

 

1

<#> <#> This example shows how to parse CSV file

2

Macro execution: ONLY COMMANDS

3

<#> <#>Load CSV file

4

File CSV Load c:\data\file1.csv, File handle variable = vCsvFile,%p3_name =

5

<#> <#>Read all records in loop

6

Repeat steps UNTIL "1" (Counter variable initial value = "i=0", Counter loop increment = "1")

7

File CSV Get Record Fields (File handle variable = "vCsvFile", Variable array for fields = "vFields", Variable for number of fields = "vFieldsNum")

8

IF %vFieldsNum%<=0

9

<#> <#>No more records to process

10

Repeat steps BREAK

11

ENDIF

12

Repeat steps UNTIL "%r%