CopyField

Top  Previous  Next

S

A

W

WS

ü

ü

 

The following commands have been implemented in EMUEScript exactly as they are implemented in OLIE™:

 

Syntax - Copying from a file

CopyField <variable name> FILE <field number> <delimiter>

 

Syntax - Copying from a variable

       CopyField <variable name> <source variable> <field number> <delimiter>

       Where:

       <variable name> is the user defined name that is assigned to the variable

       <source> is a literal string or a variable containing a literal string

       <field number> is an integer or a variable containing an integer

       <delimiter> is a literal string containing a single character or a variable containing a single character

 

Description:

This command is used to copy a value from a delimited file or variable.  It is used most frequently with comma separated files  (.csv).  If FILE is used rather than another variable, the file referenced is the input file and the delimited line is the last line that was read.  If the file or variable is separated by  the <delimiter> into groups of text, the value stored in <variable name> will be the section of text reached after counting <field number> sections going from left to right in the original text.  That is, if <field number> is 4 and the <delimiter> is a comma, then the value stored in <variable name> would be the fourth comma-separated field.

 

Sample 1:

       The following statement uses the CopyField command to store the third field separated by a comma from the input file into the variable DOS.

CopyField DOS File 3 ","

 

Sample 2:

       The following example separates a name field into first name and last name.

CopyField FName PtName 2 ","

CopyField LName PtName 1 ","