|
Environment Variables - List |
Declaration
<AMENVVARS ACTIVITY="list" RESULTDATASET="text" TYPE="text (options)" />
Description
Retrieves a list of existing user, machine or process level environment variables and populates a dataset with their names and values.
Practical Usage
Commonly used to get a list of environment variables and then loop through the list using the Loop - Dataset activity in order to perform operations on each one.
Parameters
Environment Variable
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Variable scope | Text | Yes | User |
|
The
environment variable scope or level to retrieve the listing from.
The available options are:
|
Create and populate dataset | Text | Yes | (Empty) | RESULTDATASET="datasetName" | The name of the dataset to create and populate with the names and values of the environment variables. More on the dataset names and field values that this activity creates can be found below under Datasets. |
Additional Notes
Datasets
A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields in addition to the standard dataset fields. The table below describes these fields (assuming the dataset name assigned was theDataset).
Name | Type | Return Value |
---|---|---|
theDataset.VarName | Text | Returns the name of the environment variable. |
theDataset.VarValue | Text | Returns the value of the environment variable. |
Example
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Description
This sample task uses an Environment Variables - List activity (step 1) to retrieve all "user" level environment variables and populates a dataset with the results. A Loop - Dataset activity then loops through the dataset. Thereafter, a Dialog - Message activity displays each environment variable retrieved during each loop process.
<AMENVVARS ACTIVITY="list" TYPE="USER" RESULTDATASET="theDataset" />
<AMLOOP ACTIVITY="dataset" DATASET="theDataset" />
<AMSHOWDIALOG WINDOWTITLE="ENVIRONMENT VARIABLE NAME/VALUE">Environment Variable Name:%theDataset.VarName%Environment Variable Value:%theDataset.VarValue%</AMSHOWDIALOG>
<AMLOOP ACTIVITY="end" />