markAsBeginning Statement

Added: build 1

Purpose

Sets the beginning reference point for row numbers within a file. The line containing the search string becomes line 1; All subsequent rows are numbered relative to it.

Applicability

The markAsBeginning statement can be used within RowFieldInputFile and RowFieldOutputFile sections.

Additional Information

Syntax

markAsBeginning <string> [occurrence=#][offset=#][regex=true|false]

Arguments

NameDescription
string This argument is a string that is being searched for. The row that contains this string will become line number 1.

Example : The user knows that the output file will have several sections. Each section has a title that is always the same, Total Values and Summary. The position of values relative to these lines is known, but the location of the title lines will vary. If the file has this structure:

...
Total Values (SI units)
speed: 5.233
weight: 4.32
...
Summary
total time: 5.02
total friction: 0.95
...
the values for weight and total time can be found with this code:
markAsBeginning "Total Values" 
 
#          name    type    row  field  
variable:  weight  double  3    2 
... 
  
markAsBeginning "Summary" 
 
#          name    type    row  field 
variable:  time    double  2    2 
... 
The FileWrapper program will locate Total Values and set it to be row one. It will then use the row and field information to locate weight using this reference point. Similarly, it will then locate Summary and find the value for time.

Options

NameDescription
occurrence This option lets the user specify the number of times to search for the specified string (default is 1). A negative value will cause it to search backward from the previous markeAsEnd statement or from the end of the file if no markAsEnd statement has been specified. Note: doesn't count multiple occurrences on the same line; uses the first
offset This option allows users to specify where the desired search line is in reference to the search criteria (default is 0). This number may be negative.
regex New as of build 159. If true, the string should be treated as a regular expression rather than a simple string search. Default is false.

Example

outputs:
val=1
val=2
outputs:
val=3 
val=4
outputs:
val=5
val=6
To make the line "val=5" line 1, use the following markAsBeginning statement:
markAsBeginning "outputs" occurrence=3 offset=1

See also Analysis Server | FileWrapper | FileWrapper Statements