With Environment…Do…End Statement (FPScript)

09.03.2021

Sets one or more FPScript environmental variables to a particular value and compiles a series of statements within the context of these set environmental variables or runs these within this context.

Syntax

With Environment Variable1 = Value1[, Variable2 = Value2] ... [, Variable8 = Value8] Do

   [Statements]

End

The syntax of the With Environment...Do...End statement consists of the following elements:

Element

Description

Variable1...8

One of the following environment variables:

Variable

Description

DecimalSeparator

Affects the environment of floating point values in strings and vice versa during execution of the enclosed FPScript statements and specifies the decimal and list separators for this.

ComplexOutputMode

Affects the environment of complex numbers in strings during execution of the enclosed FPScript statements and specifies whether complex numbers with an imaginary unit is to be output as "1+2i" or separated with a list separator at output as "(1 ; 2)".

AutoDim

Affects compiling of the enclosed FPScript code and specifies whether local variables have to be declared before initial use.

DecimalsAsFloat

Affects compiling of the enclosed FPScript code and specifies whether numeric values without a decimal point and exponent are to be interpreted as integers or floating point values.

UnitControlLevel

Determines the type of unit monitoring used by FlexPro during execution of the enclosed FPScript statements.

PercentageCalculation

Affects the basic computations  while executing the enclosed FPScript statements and determines whether special percentage calculation rules should or should not apply to the units % or ppm.

UnitCollectionsEnabled

Affects compiling and execution of the enclosed FPScript code and specifies which unit collections should be used.

ParallelProcessing

Affects compiling and execution of the enclosed FPScript code and specifies whether the appropriate FPScript operations should be executed on multiple CPU cores sequentially or concurrently.

Value1...8

Determines the setting that should apply to the selected environment variable while the enclosed rows are compiled or executed.

Variable

Value

DecimalSeparator

fpDecimalSeparatorSystem

Based on Windows System Settings

fpDecimalSeparatorPoint

Decimal point and comma as list separator

fpDecimalSeparatorComma

Decimal point and simicolon as list separator

ComplexOutputMode

fpComplexOutputModeSeparator

Separated with list separator in the format "(1 ; 2)".

fpComplexOutputModeImaginaryUnit

With the imaginary part in the format "1+2i".

AutoDim

True

Local variables do not have to be declared before being used for the first time.

False

Local variables have to be declared.

DecimalsAsFloat

True

Numeric values without a decimal point and exponent are interpreted as floating point values.

False

Numeric values without a decimal point and exponent are interpreted as integers.

UnitControlLevel

fpUnitControlLevelNone

FPScript ignores all units and performs calculations with numeric values only.

fpUnitControlLevelTolerant

FPScript performs calculations with quantities, i.e. values with a unit, adjusts units to each other during processing, and checks units for compatibility before processing. This mode also permits units whose SI dimension is unknown to FlexPro. These types of units must match exactly when processing two data sets. In addition, in this mode, compound units without spaces or multiplication signs between the element units are permitted, such as "Nm" instead of correctly as "N m" or "N·m".

fpUnitControlLevelModerate

Specifies the Tolerant setting with the limitation that compound units without spaces or multiplication signs between the element units are not permitted.

fpUnitControlLevelStrict

Specifies the Moderate setting with the additional limitation that units whose SI dimension is unknown to FlexPro are not permitted.

PercentageCalculation

True

Enables the percentage calculation.

False

Disables the percentage calculation.

UnitCollectionsEnabled

A bit mask that specifies which unit collections should be enabled. The order of the bits corresponds to the order in which the unit collections appear in the Options dialog box on the Unit Manager tab.

ParallelProcessing

True

Executes appropriate FPScript operations concurrently on multiple CPU cores.

False

All FPScript operations are executed in sequential order.

Statements

One or more statements that should be compiled or executed in the context of the set environment variables.

Remarks

Use this statement to write FPScript code that is independent of the external settings.

Note:   As mentioned above, the setting of some variables affects compiling of the FPScript code. For these variables, Value must be specified as a constant. For the remaining variables, you can specify any FPScript expression that provides the desired value.

Available in

FlexPro View, Basic, Professional, Developer Suite

Example

Converts a complex number to a string with the content "(1,2 ; 2,4)".

Dim Str

With Environment DecimalSeparator = fpDecimalSeparatorComma, ComplexOutputMode = fpComplexOutputModeSeparator Do

    Str = String (1.2, 2.4)

End

Return Str

Share article or send as email:

You might be interested in these articles