markAsEnd Statement

Added: build 1

Purpose

Sets the ending reference point for row numbers in a file, starting the search from the end of the file and moving back towards the beginning of the file. The line containing the search string becomes line -1. All rows above it are numbered relative to it in descending order (i.e., -2, -3, etc.).

Applicability

The markAsEnd statement can be used within RowFieldInputFile and RowFieldOutputFile sections. The statement can be used multiple times within a given section.

Additional Information

Syntax

markAsEnd <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.

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 forward from the previous markeAsBeginning statement or from the beginning of the file if no markAsBeginning 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

The user knows that the output file will have only one section that ends with a End Totals tag. The position of values relative to this tag is known, but the location of the tag itself varies.

The file could have the following structure:

...
total time: 5.02
total friction: 0.95
End Totals
...
The values for total time and total friction can be found using the following code:
markAsEnd "End Totals" 
 
#          name      type    row  field 
variable:  time      double  -3   2 
variable:  friction  double  -2   2
  

The file wrapper program will locate the tagged line and then use the row and field information to locate values.

See also Analysis Server | FileWrapper | FileWrapper Statements