Salesforce

How Do I Set and Use Global Variables (per Context Only)? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Set and Use Global Variables (per Context Only)? (Magic xpa 3.x)

Any variables you declare in the Main Program are available from anywhere in your project. In this example, for instance, we have set up a “Company Name” virtual, so we can use it in various paperwork and exports.

You can initialize the virtual by using an Init expression, as we did here. Translate(‘%Company%’) fetches the company name as a logical name from the Magic.Ini. Alternatively, we could have called a program in the Task Prefix to fetch the Company Name from a database table, or brought in the data with a link to a table.

Note: If you link to a table in the Main Program, then at runtime, the Data source is read-only, and the Data source is kept open as long as the project is open.

Using Global Variables

Once you have the variables in the Main Program, you can access them as you would any other variable. They show up at the top of the variable list from any task you are working on. You can fetch data from them in your Expressions, or move data to them using Update operations.

Reference
Attachment 
Attachment