Expression for Displaying Fractions of an Inch - Intergraph Smart Instrumentation - Help

Intergraph Smart Instrumentation Help

Language
English
Product
Intergraph Smart Instrumentation
Search by Category
Help
Smart Instrumentation Version
13.1

In the following example, the compute expression defined for the computed field c_af_value_err_1 allows you to display a calibration result in the feet-inch-sixteenths format. This computed field displays a result of the tape reading value of tank height minus gauge reading value in a tank strapping calibration. In the compute expression, the following table columns participate:

as_found_value

Tape reading value in the feet-inch-sixteenths format with the ##-##-##/16 mask defined on the Edit and Format tabs of the Properties window

as_left_value

Gauge reading value in the feet-inch-sixteenths format with the ##-##-##/16 mask defined on the Edit and Format tabs of the Properties window

If you only used decimal values, the c_af_value_err_1 field would only include the following expression:

as_found_value[0] – as_left_value[0]

The [0] value indicates that this is the first calibration result in the number or runs. The PowerBuilder data window used in the calibration form page contains an array that allows you to enter several result points in the same table column. In the data window, the first occurrence of the column in the array is indicated with the [0] value, the second with [1], and so forth. Therefore, in a compute expression, all the fields should be specified the appropriate result point number in the array. Because the expression includes actual table columns, you do not need to specify any suffixes of multi-use columns. In the form page, each occurrence of a multi-use column is indicated with a unique numeric suffix. For example, when inserting the as_left_value column into the form page three times, you must specify the _1 suffix for the first occurrence of the as_left_value column, _2 for the second occurrence, and _3 for the third occurrence. In the data window, the first occurrence of the column in the array is indicated with the [0] value, the second run with [1], and so forth.

To use the feet-inch-sixteenths format in the c_af_value_err_1 computed field, the compute expression must be as follows:

getmaskedfeetvalue(getdecimalfeetlength(Left(String((as_found_value[0]),
abs(5-Len(String(as_found_value[0])))+1),
Mid(String(as_found_value[0]),
abs(5-Len(String(as_found_value[0])))+2,2),
Right(String(as_found_value[0]),2))
- getdecimalfeetlength(Left(String(as_left_value[0]),
abs(5-Len(String(as_left_value[0])))+1),
Mid(String(as_left_value[0]),
abs(5-Len(String(as_left_value[0])))+2,2),
Right(String(as_left_value[0]),2)))

In the compute expression, the following rules and conditions apply:

  • The table columns must be defined a feet-inch-sixteenths mask ##-##-##/16 on the Edit and Format tabs of the Properties window.

  • The computed field that includes these table columns must also have the same feet-inch-sixteenths mask on the Format tab of the Properties window.

  • The compute expression must include the getmaskedfeetvalue and getdecimalfeetlength functions. Without these function, the computed field on the calibration form does not display the correct value. The getdecimalfeetlength function reads the values from each segment in the mask and retrieves the decimal value of the feet length. After that, the getmaskedfeetvalue reads the decimal value and displays the value in the feet-inch-sixteenths format in the calibration form.

  • Although the compute expression seems complex, when defining another expression, you can copy the current expression to the target computed field, and then, you only need modify the result point occurrence in the array and the field names.

  • getdecimalfeetlength and getmaskedfeetvalue are Smart Instrumentation internal functions (not available in InfoMaker).

  • The feet-inch-sixteenths format is not supported outside the Calibration module, that is, when accessing the field from database tools.

  • It is only possible to display sixteenths of an inch in a calibration form field.