keyVariable Statement

Added: build 160

Purpose

Creates input and output variables.

Applicability

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

Additional Information

Syntax

keyVariable: <name> <type> <searchString> [occurrence=#]
                                          [rowOffset=#][field=#]
                                          [default=value][fformat=string]
                                          [description=string][units=value] 
                                          [upperBound=value][lowerBound=value]
                                          [ignoreConversionErrors=true/false]
                                          [enumValues=val1,val2,...,valN] 
                                          [enumAliases=val1,val2,...,valN] 

Arguments

NameDescription

name The name is a string that specifies what the variable will be called.
type The type can be any primitive type supported by the Analysis Server: double, integer, string, boolean, and reference.
searchString The string to search for in the file. The variable is positioned relative to this string. Searches are performed within the region currently marked with the markAsBeginning and markAsEnd statements.

Options

NameDescription

occurrence This option lets the user specify the number of times to search for the specified string (default is 1). Negative numbers will search for occurrences starting from the end of the file and counting backwards. Note: doesn't count multiple occurrences on the same line; uses the first
rowOffset This value specifies the row (relative to the row that contains the search string) where the variable can be found. The default is 0, i.e. the row that contains the search string.
field This value specifies the field where the variable can be found. The default is 1, i.e. the value following the search string. The delimiters being used (see the setDelimiters section) determine the fields. If a negative number is used, it will count from the end of the row backwards, but will not count past the key variable
default This option can be used to specify a default value. All entries in the variable will be set to this value initially. A default argument will take precedence over the initializationFile.
fformat This option specifies a standard FORTRAN formatting string that controls the width and type formatted variable. The Analysis Server supports the I, G, E, F, and A FORTRAN formatting options.
description This option allows the user to write a description for the variable.
units This option allows the user to write a units string for the variable.
upperBound This option allows the user to set an upper bound for the variable.
lowerBound This option allows the user to set a lower bound for the variable.
ignoreConversionErrors This option applies to doubles and integer type variables only; if the number cannot be converted into an appropriate format, i.e., a string is assigned to a double, the FileWrapper will not generate an error with this option set to true.
enumValues This option allows the user to specify the set of possible values for the variable. The enumerated values are specified as a comma separated list of values.
enumAliases New as of build 169. This option allows the user to specify a set of string values that may be associated with the enumerated values. If the variable is set to a value in the alias set, the actual value will be set to the corresponding value in the enumValues set. The aliases are specified as a comma separated list of values. There must be the same amount of elements in the enumValues and enumAliases sets.

Example

If the following is a portion of an input file:
width=1
height=2
depth=3,4,5
then the section below could be used in a RowFieldInputFile to describe the locations of variables:
setDelimiters " =,"
#        name    type    key
keyVar:  width   double  "width"
keyVar:  height  double  "height"
keyVar:  depth1  double  "depth"
keyVar:  depth2  double  "depth" field=2
keyVar:  depth3  double  "depth" field=3

See also Analysis Server | FileWrapper | FileWrapper Statements