Environment Variables

Environment variables allow you to parameterize the build location, system name, variable names, and many other option of your design. You can then refer to an environment variable throughout a FastStats Designer design. This is useful if you have to build several similar systems from one design. For example you can could have a single design and use it to build and deploy to 'test','uat' and 'live' systems.

Add an environment variable by giving it a name and a value in the Environment tab of the System Configuration. Alternatively you can use environment variables taken from the system.

Refer to the environment variable by enclosing it in % symbols:

When running a build from the command line any environment variables defined are passed to and used by Designer, overriding those defined in the design. So for the design above if the build is run from a batch file then the variable NAME could be defined in the batch file and then the substituted version will be used throughout the design.

System defined environment variables

There are some special system defined environment variables, you are not allowed to redefined these variables names:

%REVISION% - The current revision number

There are also some environment variables that can only be used when defining an SQL code source to obtain decodes and descriptions:

%FSVARNAME% - Variable name

%FSVARDESC% - Variable description

%FSVARREF% - Variable reference

%FSVARDBNAME% - Source database field name (if table is coming from a database data source or the header if the data source is a delimited file)

%FSBUILDDATE% - Build date in YYYYMMDD format

%FSBUILDTIME% - Build time in HHMMSS format

%FSBUILDDATE_FMT% - Build date in system locale format

%FSBUILDTIME_FMT% = Build time in system locale format

Use of environment variables within SQL queries

It is possible to use environment variables with SQL queries for data source, code sources and post-load actions.

Environment variable substitution does not occur for strings within single quotes (')or double quotes (")

So for this statement:

Copy

SQL

SELECT * FROM %TABLENAME% WHERE Surname LIKE '%SURNAME%'

%TABLENAME% will be substituted while %SURNAME% will not.

To perform this kind of substitution you must define your environment variable including the quotes and % characters:

TABLENAME = People

SURNAME = '%Jones%'

Copy

SQL

SELECT * FROM %TABLENAME% WHERE Surname LIKE %SURNAME%

This will then run the command:

Copy

SQL

SELECT * FROM People WHERE Surname = '%Jones%'