Appendix: Reference

Environment Variables

Environment Variables

Omnidex allows environment variables to be used in several locations within the product. The general syntax for environment variables differs between Microsoft Windows and Linux, and so Omnidex provides a common syntax that can be used on all platforms.

Syntax

The syntax for using environment variables is to enclose the string in curly braces, and then prefix the environment variable with a dollar sign ($). For example, given the following environment variables …

MAIN_PATH="d:/class"
LAB_PATH="lab1"
FILENAME="simple.xml"
FULL_FILENAME="d:/class/lab1/simple.xml"

… any of the following strings will be equivalent:

d:/class/lab1/simple.xml
{$MAIN_PATH/lab1/simple.xml}
{$MAIN_PATH/$LAB_PATH/simple.xml}
($MAIN_PATH/$LAB_PATH/$FILENAME}
{$FULL_FILENAME}

Multiple Filenames

In some locations within Omnidex, it is possible to submit a collection of filenames. For example, the PHYSICAL clause of the CREATE TABLE statement can reference multiple filenames when using Raw Data Files. In this case, multiple filenames can be included, each of which is surrounded by curly braces.

"{$MAIN_PATH/$LAB_PATH/individuals_01.dat},
 {$MAIN_PATH/$LAB_PATH/individuals_02.dat},
 {$MAIN_PATH/$LAB_PATH/individuals_03.dat}"

Setting Environment Variables

Omnidex will evaluate environment variables when the process is loaded or when they are first used. It is important to set the environment variables before the process is initialized. For Omnidex Network Services, it is important to set the environment variables prior to launching the OdxNet process.

Retrieving the Value of an Environment Variable

The current value of an environment variable can be retrieved using the operating system commands. For Microsoft Windows, the command is:

echo %MAIN_PATH%

For Linux, the command is:

echo $MAIN_PATH

The current value of an environment variable can also be retrieved using the $GETENV function of Omnidex SQL. For example, the following statement will retrieve the value of the environment variable MAIN_PATH. Note that this statement retrieves from the table $OMNIDEX, which is a virtual table that always contains one column and one row.

select $getenv('MAIN_PATH') from $omnidex;

The $GETENV fnction can also be used as criteria in queries, as shown in the following example:

select * from INDIVIDUALS where COUNTRY = $getenv('LOCAL_COUNTRY');

Additional Resources

See also:

 
Back to top
appendix/reference/envvar/variables.txt · Last modified: 2016/06/28 22:38 (external edit)