Salesforce

Environment Variables (Magic xpi 4.6)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

Environment Variables (Magic xpi 4.6)

Environment variables are used for defining the external IT environment properties inside a Magic xpi project. You can create environment variables to use in place of an actual file name, allowing the smooth portability of flows from the development environment to the deployment environment.

Environment variables do this by creating variables for flow elements without an explicit relation to the physical storage media or operating system naming conventions where they are located. For example, you can assign an environment variable to a database. You then use the environment variable instead of the actual name when you enter the database information in the appropriate Magic xpi dialog box.

Magic xpi achieves portability by translating the environment variables at runtime, according to the values entered in the Settings dialog box's General Environment section. These values are automatically entered into one of the Magic xpi configuration files. However, although the environment variables translation can be changed at runtime, they are mostly used as constants.

Environment variables can be used within other environment variables (nested environment variables). For example, you can have the currentprojectdir environment variable include the projects and sl environment variables as part of its translation, and the projects environment variable include the Magic xpi environment variable as part of its translation (project = %Magicxpi%projects%sl%).

Note:

As of Magic xpi 4.5, the ifs.ini file always takes precedence over the Magic.ini file, both in the Studio and Runtime. In Magic xpi 4.1 and earlier, the Magic.ini file took precedence in the Studio and the ifs.nii file took precedence in Runtime, so that you had to maintain your environment variables in both.

If an environment variable exists in a project's Magic.ini file and also in its ifs.ini file, the Magic xpi Studio uses the value of the variable in the ifs.ini file. If an environment variable exists only in a project's ifs.ini file, it is available for use in a project.

Best Practices

Use environment variables explicitly only when dynamic behavior is required and expressions cannot be used.

All of the project's Servers must share the same environment variables. These values are loaded by each of the processes from the Magic.ini file, and are not managed globally in the Space.

Environment variables allow you to easily move from the Magic xpi Suite's Windows-based development environment to a Unix, Linux, or System i deployment environment, using only the Magic xpi Server. This is because:

  • Environment variables can be changed in the configuration file after you deploy on the Magic xpi Server. This allows you to easily make changes to names of elements after you leave the development environment. For example, if you use a database in the development environment called Management and the name of the same database in the deployment environment is called Managers, the Magic xpi Server must be able to recognize the new name. If you use an environment variable, you can change the value in the configuration file in the Server environment. For example, you can create an environment variable called Manage in the Settings dialog box's Resources section. If you enter the value for this as Management, it is entered in the configuration file as Manage=Management. When you deploy the project, change the configuration file entry to Manage=Managers and the Magic xpi Server will recognize the new database name.

  • Environment variables can be used to create names and file paths that are recognized in both a Windows® environment and a Unix, Linux, or IBM i environment. For example, Magic xpi contains a standard environment variable called SL. This name translates to a forward or backward slash. When you replace all backslashes with this environment variable, you can deploy a project on a Unix, Linux, or IBM i machine without having to change the backslashes to forward slashes.

Environment Settings

The Settings dialog box's Environment section lets you easily assign environment variables, which are used instead of a flow element's actual name. You can assign environment variables to databases, files, folders, and most other elements used in your integration flows.

Environment variables are stored in the current resource file.

Environment Variables and Multiple Projects

Working in a multiple project environment has implications for environment variable definitions. If you define environment variables for the project, you should click the Save button each time you make changes in the Settings dialog box's Environment section. This opens the Save ini dialog box, where you should enter the name and location of the ifs.ini file for the project (in the project folder). The default file is the ifs.ini file for the current project.

Related Topics

Reference
Attachment 
Attachment