Docs Menu
User Guide / Configuration Types

Working with Set Dialog for Initialize Element

Select the variable created in the Request or Response sections and click on initialize element in the toolbar and the Set dialog will be displayed.

Let us discuss all the options provided in the Set Dialog

Option Name Operation
None Using this option, a constant value can be assigned to the variable
Evaluate Expression An expression can be given
Evaluate Local Package variables Here the value can be picked from the local configuration
Evaluate Package Configuration Variables Here the value can be picked from the Package Configuration
Evaluate Global Configuration Variables Here the value can be picked from the Global Configuration

The details with relevant examples for the various options of the Set dialog are shown below

1) None

Let us print the values assigned to the variable test in the output. We have already initialized the variable test to a string value as Blank while selecting None in the Set options. Now create an output parameter and name it test2.

Go to the configuration section and copy the service endpoint

Open any browser and paste the service endpoint there. The value of test2 ie. Blank will be displayed in the browser

2) Evaluate Expression

This will be used to evaluate local configuration variables. To illustrate this let us create two variables under a Transformer intA and intB and try to add them and print the output.

Create A new TRANSFORMER

Create two integer variables intA and IntB in the Response Section

Create a new TRANSFORMER and create an integer variable intC in the Response Section.

Select intC in the Response Section and click on initialize element.

In the value textbox enter #{itnA} + #{intB} and click on the OK Button

Also, create one more integer variable intC as an output Parameter.

Save the service and test the endpoint on the browser.

Clearly, we are observing the intC value equals 30.

This is how we use to Evaluate Expressions option.

All the java functions can also be used in the Evaluate Expression Option for evaluation.

3) Evaluate Local Configuration Variables

Let us try to print the values variable strVal which has been kept inside the Local Configuration Variables of the configuration dialog.

Let us first create a local configuration and assign a value to a variable

strVar = Local Configuration Value

To implement that

click on the configuration icon on the workspace. A configuration dialog will appear

now type the variable and the value in the configuration properties section and click on ok button.

Now go back to the API service and create a new TRANSFORMER

Click on the TRANSFORMER and create a string variable strEvalExp in the Response Section

Select the strEvalExp variable and click on Initialize Element

Enter the #{strVal} in the value field and select Evaluate Local Configuration Variables from the option list and click on the OK button.

Now to print the value of strEvalExp in the output,  Create one strEvalExp as an output parameter.

Save the Service

Copy the endpoint from the configuration dialog

Paste the endpoint in the address bar of the browser and hit enter and visualize the output

We observe that both the values of test2 and strEvalExp are displayed.

The local confirmation file will also be displayed in the configuration folder of the package and is displayed as a path on the workspace window.

4) Evaluate Package Configuration Variables

This is used to access the variable in the package’s configuration file. To implement this follow the steps

Click on the package and select the config folder. Under config folder click on the package file.

The Package file will open in the workspace

Now type the variable name strPackValue and the value in the package configuration file

Save the configuration file by clicking on the save icon at the top.

Now go back to the API service and create a new TRANSFORMER

Click on the TRANSFORMER and create a string variable strPack in the Response Section

Select the strPack variable and click on Initialize Element

Enter the #{strPackValue} in the value field and select Evaluate Package Configuration Variables from the option list and click on the OK button.

To print the value on the browser, create one more String variable strPack as an output parameter

Execute the endpoint on the browser and visualize the output

Here we observe that we were able to print the Package Configuration Variables. These values are accessed from a Local Package Configuration file.

Evaluate Global Configuration Variables

Go to the Global Property Configuration File in the Package Explorer

Open the Configuration File of the Global package.

Enter [strGlobalPack = This is the Global Property File] in the Global Package property file.

Click on the save icon at the top and save the file.

Now go back to the API service and create a new TRANSFORMER

Click on the TRANSFORMER and create a string variable strGPack in the Response Section

Select the strGPack variable and click on Initialize Element

Enter the #{strGlobalPack} in the value field and select Evaluate Global Configuration Variables from the option list and click on the OK button.

To print the value on the browser, create one more String variable strGPack as an output parameter

Execute the endpoint on the browser and visualize the output

Here we observe that we were able to print the Global Configuration Variables. These values are accessed from a Global package Configuration file.