Functions that can be used in formulas are grouped into the following categories.
In each function, optional arguments are listed inside curly braces {}. If a function has more than one argument, commas separate the arguments. If a function has more than one argument, the arguments must be separated by a single comma and/or one or more spaces.
The GIS functions return values related to location.
X returns the X coordinate of a
node or the element center in global coordinates (fig. 15). (See
“The Grid” on p. 6.)
X_Prime returns the X coordinate of a node or the element center in grid coordinates (fig.15). (See “The Grid” on p. 6.)
Y returns the Y coordinate of a
node or the element center in global coordinates (fig. 15). (See
“The Grid” on p. 6.)
Y_Prime returns the Y coordinate of a node or the element center in grid coordinates (fig.15). (See “The Grid” on p. 6.)
Z returns the Z coordinate of a node
or the element center in global coordinates. (Because this is also the
Z coordinate in grid coordinates, there is no Z_Prime function) (fig.
15). (See “The Grid”
on p. 6.)
![]() |
Figure 15. Global and grid coordinate systems in GoPhast. |
---|
BlockAreaFront({Column, Layer})
returns the cross sectional area of an element or cell as seen from the
front of the grid (fig. 16). The function has two optional
arguments: Column and Layer. If these arguments are provided,
they specify the element or cell for which the area should be
calculated. If they are not provided, the function uses the
column and layer of the element or cell for which the formula is being
calculated. If either of the arguments has an invalid value, the
function returns zero.
![]() |
Figure 16. BlockAreaFront returns the product of a times c. |
---|
BlockAreaSide({Row, Layer}) is like
BlockAreaFront except that the value that is returned is the cross
sectional area of an element or cell as seen from the side of the grid
(fig. 17).
![]() |
Figure 17. BlockAreaSide returns the product of a times b. |
---|
BlockAreaTop({Column, Row}) is like
BlockAreaFront except that the value that is returned is the cross
sectional area of an element or cell as seen from the top of the grid
(fig. 18).
![]() |
Figure 18. BlockAreaTop returns the product of b times c. |
---|
BlockVolume({Column, Row, Layer}) returns the volume of an element or cell. The function has three optional arguments: Column, Row, and Layer. If these three arguments are provided, they specify the element or cell for which the volume should be calculated. If they are not provided, the function uses the column, row, and layer of the node or element for which the formula is being calculated. If any of the three arguments has an invalid value, the function returns zero.
Column returns the column number of the node or element for which the formula is being calculated.
ColumnBoundaryPosition({Column}) returns the X coordinate in the grid coordinate system of the column boundary specified by its one optional argument Column. If the optional argument is not included, the function uses the column of the node or element for which the formula is being calculated.
ColumnCount returns the number of column boundaries in the grid which equals the number of nodes in the X direction.
ColumnWidth({Column}) returns the width of the cell or element column specified by its one optional argument Column. If the optional argument is not included, the function uses the column of the node or element for which the formula is being calculated.
Layer returns the layer number of the node or element for which the formula is being calculated.
LayerBoundaryPosition({Layer}) returns the Z coordinate in the grid coordinate system of the position of the layer boundary specified by its one optional argument Layer. If the optional argument is not included, the function uses the layer of the node or element for which the formula is being calculated.
LayerCount returns the number of layer boundaries in the grid which equals the number of nodes in the Z direction.
LayerHeight({Layer}) returns the height of the cell or element layer specified by its one optional argument Layer. If the optional argument is not included, the function uses the layer of the node or element for which the formula is being calculated.
Row returns the row number of the node or element for which the formula is being calculated.
RowBoundaryPosition({Row}) returns the Y coordinate in the grid coordinate system of the position of the row boundary specified by its one optional argument Row. If the optional argument is not included, the function uses the row of the node or element for which the formula is being calculated.
RowCount returns the number of row boundaries in the grid which equals the number of nodes in the Y direction.
RowWidth({Row}) returns the width of the cell or element row specified by its one optional argument Row. If the optional argument is not included, the function uses the row of the node or element for which the formula is being calculated.
The logical functions are used to choose between two or more possible choices based on a criterion.
Case(Index, Result1, Result2, ...).
Case uses Index to determine which of the Result1, Result2... arguments
will be returned as a result. If Index equals 1, Result1 is
returned; if Index equals 2, Result2 is returned; if Index equals 3,
Result3 is returned; and so forth. Only “Index”, constant
expressions and the result that is returned will be evaluated.
The types of Result1, Result2... must all be the same but they can be
of any type. The type that is returned will be the same as the
type of Result1, Result2, ...
CaseB(Index, Boolean_Result1, Boolean_Result2, ...) is like Case except that it always returns a Boolean.
CaseI(Index, Integer_Result1, Integer_Result2, ...) is like Case except that it always returns an integer.
CaseR(Index, Real_Result1, Real_Result2, ...) is like Case except that it always returns a real number.
CaseT(Index, Text_Result1, Text_Result2, ...) is like Case except that it always returns text.
If(Boolean_Value, If_True_Result, If_False_Result) If uses Boolean_Value to determine whether If_True_Result or If_False_Result is returned as a result. If Boolean_Value is true, If_True_Result returned; if Boolean_Value is false, If_False_Result is returned. Only “Boolean_Value”, constant expressions and the result that is returned will be evaluated. The types If_True_Result and If_False_Result must be the same but they can be of any type. The type that is returned will be the same as the type of If_True_Result and If_False_Result.
IfB(Boolean_Value, If_True_Boolean_Result, If_False_Boolean_Result) is like If except that it always returns a Boolean.
IfI(Boolean_Value, If_True_Integer_Result, If_False_Integer_Result) is like If except that it always returns an integer.
IfR(Boolean_Value, If_True_Real_Result, If_False_Real_Result) is like If except that it always returns a real number.
IfT(Boolean_Value, If_True_Text_Result, If_False_Text_Result) is like If except that it always returns text.
The math functions supply general mathematical capabilities beyond the simple operations of addition, subtraction, multiplication, and division.
Abs(Value) returns the absolute
value of Value. Value can be either an integer or a real
number. The value returned by Abs will have the same type as
Value.
AbsI(Value) returns the absolute value of Value. Value must be an integer. The value returned by AbsI will be an integer.
AbsR(Value) returns the absolute value of Value. Value can be either an integer or a real number. The value returned by AbsR will be a real number.
Distance(X1, Y1, X2, Y2) calculates the distance between points (X1, Y1) and (X2, Y2).
FactorialI(Value_Less_than_13) returns the factorial of Value_Less_than_13 as an integer.
FactorialR(Value_Less_than_171) returns the factorial of Value_Less_than_171 as a real number.
Frac(Value) returns the fractional part of Value. Value is a real number.
Interpolate(Position, Value1, Distance1, Value2, Distance2). Interpolate returns (Position-Distance1)/(Distance2-Distance1)*(Value2-Value1)+Value1. As its name implies, this is an interpolation between Value1 and Value2 based on where Position is between Distance1 and Distance2. If Position is not between Distance1 and Distance2, Interpolate extrapolates a value. See also MultiInterpolate.
IntPower(Base, Exponent) returns Base raised to the Exponent power. Base is a real number or integer. Exponent is an integer. IntPower returns a real number. See also Power.
ln(Value) returns the natural log of Value.
log10(Value) returns the log to the base 10 of Value.
logN(Base, Value) returns the log to the base N of Value.
Max(Value1, Value2, ...) returns whichever of its arguments is the largest. Its arguments must be either integers or real numbers. The result will be a real number if any of the arguments is a real number. If all the arguments are integers, the result will be an integer.
MaxI(Integer_Value1, Integer_Value2, ...) returns whichever of its arguments is the largest. Its arguments must be integers. The result will be an integer.
MaxR(Real_Value1, Real_Value2, ...) returns whichever of its arguments is the largest. Its arguments must be either integers or real numbers. The result will be a real number.
Min(Value1, Value2, ...) returns whichever of its arguments is the smallest. Its arguments must be either integers or real numbers. The result will be a real number if any of the arguments is a real number. If all the arguments are integers, the result will be an integer.
MinI(Integer_Value1, Integer_Value2, ...) returns whichever of its arguments is the smallest. Its arguments must be integers. The result will be an integer.
MinR(Real_Value1, Real_Value2, ...) returns whichever of its arguments is the smallest. Its arguments must be either integers or real numbers. The result will be a real number.
MultiInterpolate(Position, Value1,
Distance1, [Value2, Distance2,] ...). If Position is less than or equal
to Distance1, MultiInterpolate returns Value1. If Position is
greater than or equal to DistanceN, MultiInterpolate returns
ValueN. If Position is between any two adjacent distances, linear
interpolation between the associated values will be used to determine
the value that will be returned. Each distance after Distance1
must be greater than its predecessor. See also Interpolate.
Odd(Value) returns True if Value is an odd number. Otherwise it returns False. Value must be an integer.
Pi returns the ratio of the circumference of a circle to its diameter.
Power(Base, Exponent) returns Base raised to the Exponent power. Base and Exponent are real numbers or integers. Power returns a real number. See also IntPower.
Round(Value) converts Value to the nearest integer. In the case of a number that is exactly halfway between two integers, it converts it to whichever one is even. See also Trunc.
Sqr(Value) returns Value squared. Value can be either an integer or a real number. The result of Sqr will be an integer if Value is an integer. Otherwise it will be a real number.
SqrI(Integer_Value) returns Integer_Value squared. Integer_Value must be an integer. The result of SqrI will be an integer.
SqrR(Real_Value) returns Real_Value squared. Real_Value can be either an integer or a real number. The result of SqrR will be a real number.
Sqrt(Value) returns the square root of Value.
Trunc(Value) truncates Value to an integer by rounding it towards zero. See also Round.
The object functions return values that are related to the properties of objects.
FractionOfObjectLength: FractionOfObjectLength
is intended for use with objects that are lines rather than points or
polygons. If the object being evaluated does not intersect the
cell or element being evaluated, FractionOfObjectLength returns
zero. If the object being evaluated is in the cell or element
being evaluated, FractionOfObjectLength returns zero if the first
vertex of the object is in the element or cell and returns one if the
last vertex of an object is in the element or cell. It returns a
fraction between zero and one for all other elements or cells. The
value that is returned represents the fraction of an object’s length
between the start of the object and the midpoint of an objects
intersection with a cell or element (fig. 19). If an object
intersects a cell or element more than once, the value that will be
applied is the result of the last intersection between the object and
the cell or element.
![]() |
Figure 19. FractionOfObjectLength returns 0.30. |
---|
ObjectArea returns the two-dimensional area of an object. (It does not take into account the areas of any other objects that might be inside it.)
ObjectCurrentVertexX: ObjectCurrentVertexX is intended for use with points and polyline objects. If the object being evaluated does not intersect the cell or element being evaluated, ObjectCurrentVertexX returns zero. If one of the vertices of an object is in the element or cell, ObjectCurrentVertexX returns the X coordinate of that vertex. Otherwise, ObjectCurrentVertexX returns the X coordinate of the first place where the object intersects the cell or element. For objects drawn on the side view of the model, ObjectCurrentVertexX returns 0.
ObjectCurrentVertexY:
ObjectCurrentVertexY is intended for use with points and polyline
objects. If the object being evaluated does not intersect the
cell or element being evaluated, ObjectCurrentVertexY returns
zero. If one of the vertices of an object is in the element or
cell, ObjectCurrentVertexY returns the Y coordinate of that
vertex. Otherwise, ObjectCurrentVertexY returns the Y coordinate
of the first place where the object intersects the cell or element. For
objects drawn on the front view of the model, ObjectCurrentVertexY
returns 0.
ObjectCurrentVertexZ: ObjectCurrentVertexZ is intended for use with points and polyline objects. If the object being evaluated does not intersect the cell or element being evaluated, ObjectCurrentVertexZ returns zero. If one of the vertices of an object is in the element or cell, ObjectCurrentVertexZ returns the Z coordinate of that vertex. Otherwise, ObjectCurrentVertexZ returns the Z coordinate of the first place where the object intersects the cell or element. For objects drawn on the top view of the model, ObjectCurrentVertexZ returns 0.
ObjectCurrentSegmentLength:
If the object being evaluated does not intersect the cell or element
being evaluated, ObjectCurrentSegmentLength returns zero. Otherwise it
returns the length of the segment that intersects the cell or
element. If two or more segments of the same object intersect the
cell or element, ObjectCurrentSegmentLength returns the length of the
last one to intersect the cell or element.
ObjectIntersectArea({Column, Row, Layer}) returns the two-dimensional area of intersection between a cell or element and an object. The function has three optional arguments: Column, Row, and Layer. If these arguments are provided, they specify the cell or element for which the area should be calculated. If they are not provided, the function uses the column, row, and layer of the node or element for which the formula is being calculated. If any of the arguments has an invalid value, the function returns zero. If the object being evaluated intersects the cell or element being evaluated more than once, ObjectIntersectArea returns the sum of all the individual areas of intersection.
ObjectIntersectLength({Column, Row, Layer}) returns the length of intersection between a cell or element and a 2D projection of the object. The function has three optional arguments: Column, Row, and Layer. If these arguments are provided, they specify the cell for which the length should be calculated. If they are not provided, the function uses the column, row, and layer of the node or element for which the formula is being calculated. If any of the arguments has an invalid value, the function returns zero. If the object being evaluated intersects the cell or element being evaluated more than once, ObjectIntersectLength returns the sum of all the individual lengths of intersection.
ObjectLength
returns the length of an object in the two dimensional projection in
which it is created and edited. Formulas for the third dimension
of an object are not taken into consideration when computing
ObjectLength.
ObjectName returns the name of the object that is currently being evaluated. ObjectName returns text.
ObjectVertexCount returns the number of vertices in the object.
ObjectVertexDistance(VertexIndex) returns the distance along the length of the object from the beginning of the object to the vertex indicated by VertexIndex. Formulas for the third dimension of an object are not taken into consideration when computing ObjectVertexDistance.
ObjectVertexX(VertexIndex)
returns the X coordinate of the vertex in the object indicated by
VertexIndex. For objects drawn on the side view ObjectVertexX
returns the Y coordinate of the vertex indicated by VertexIndex.
ObjectVertexY(VertexIndex) returns the Y coordinate of the vertex in the object indicated by VertexIndex. For objects drawn on the front and side views ObjectVertexY returns the Z coordinate of the vertex indicated by VertexIndex.
VertexInterpolate(Value1, Value2,
...). VertexInterpolate is intended for use with objects that are
polylines rather than points or polygons. If the object that is
being evaluated does not intersect the cell or element that is being
evaluated, VertexInterpolate returns zero. If the object that is
being evaluated does intersect the cell or element that is being
evaluated, VertexInterpolate assigns Values1 to ValueN to vertices 1 to
N respectively of the object where N is the smaller of the number of
arguments in VertexInterpolate and the number of vertices in the
object. If the number of vertices in the object is greater than
the number of arguments, the value of the last argument will be
assigned to each of the vertices in the object that would not otherwise
have an associated value. If a vertex of the object is in an
element or cell, the associated value will be assigned to the element
or cell. Otherwise the values will be interpolated from the end
points of the line segment that intersects the cell or element using
linear interpolation based on the distance from the center point of the
line segment within the cell or element to the adjacent vertices in the
object (fig. 20). If more than one vertex of an object is in a
cell or element or the object intersects a cell or element more than
once, the value that will be applied is the value for the last vertex
or segment to intersect the cell or element. VertexInterpolate
returns a real number.
![]() |
Figure 20. VertexInterpolate(1,2,3) returns the values shown for each element. |
---|
The Text functions are used for manipulating text. One way they can be used is to control which shapes from a Shapefile are imported. See “Import Shapefile Dialog Box” on p. 24.
Copy(Text_Value,
StartIndex, Count) returns a portion of Text_Value starting at the
character indicated by StartIndex and extending for either Count
characters or until the end of Text_Value is reached whichever is
smaller.
FloatToText(Value) converts the real number Value to its text representation.
IntToText(Value) converts the integer number Value to its text representation.
Length(Text_Value) returns the number of characters in Text_Value.
LowerCase(Text_Value) returns Text_Value with all its characters converted to lower case. See also: UpperCase.
Pos(SubText, Text_Value) returns the position of the first instance of SubText within Text_Value. If SubText does not occur within Text_Value, Pos returns 0.
PosEx(SubText, Text_Value, Offset) returns the position of the first instance of SubText within Text_Value that starts on or after Offset. If SubText does not occur within Text_Value, on or after Offset, PosEx returns 0. If Offset equals one, PosEx is equivalent to Pos.
TextToFloat(Text_Value) converts Text_Value to a real number. If Text_Value can not be converted, TextToFloat causes an error.
TextToFloatDef(Text_Value, DefaultResult) converts Text_Value to a real number. If Text_Value can not be converted, DefaultResult is returned instead.
TextToInt(Text_Value) converts Text_Value to an integer. If Text_Value can not be converted, TextToInt causes an error.
TextToIntDef(Text_Value,
DefaultResult) converts Text_Value to an integer. If Text_Value
can not be converted, DefaultResult is returned instead.
Trim(Text_Value) removes spaces from the beginning and end of Text_Value.
UpperCase(Text_Value) returns Text_Value with all its characters converted to upper case. See also LowerCase.
The trig functions are used for trigonometric operations. All angles in the functions are expressed in radians unless otherwise noted.
ArcCos(Value) returns the inverse cosine of Value. The return value is in the range from zero to Pi.
ArcCosh(Value) returns the inverse hyperbolic cosine of Value.
ArcSin(Value) returns the inverse sine of Value. The return value is in the range from -Pi/2 to +Pi/2.
ArcSinh(Value) returns the inverse hyperbolic sine of Value.
ArcTan2(Y, X) returns the inverse tangent of Y/X in the correct quadrant. The return value is in the range from -Pi to +Pi.
ArcTanh(Value) returns the inverse hyperbolic tangent of Value.
Cos(Value) returns the cosine of Value.
Cosh(Value) returns the hyperbolic cosine of Value.
DegToRad(Value) converts Value from degrees to radians. See also RadToDeg.
RadToDeg(Value) converts Value from radians to degrees. See also DegToRad.
Sin(Value) returns the sine of Value.
Sinh(Value) returns the hyperbolic sine of Value.
Tan(Value) returns the tangent of Value.
Tanh(Value) returns the hyperbolic tangent of Value.