Map lookup
The Map lookup policy item allows you to have the policy item lookup the value of a current piece of event data, and see if it is defined on a list of mapped values. If it matches an entry on the list, then the policy item will map it to a new corresponding value. This new value (called Result) can then be used inside an expression that will be executed by the Use the result in the following expression field. The Map lookup policy item lets you define what values will be used depending on the current value of the event data being looked up.
To use the Map lookup:
- Select or create a policy to open a policy editor.
- In the Items section of the policy editor toolbox, select the Map lookup policy item and drag it to the worksheet. This will automatically open the Map lookup properties.
- In the Take the value of field, enter which piece of event data the Map lookup policy item will check the value of. You can use the Insert symbol button
to open the Symbol Browser to select which piece of event data will be checked.
- In the Matching values column, enter the required value that the selected piece of event data should be matched against. Like other value matching dialogs in WinGate you have the choice of selecting the type of method used for matching. (i.e. Exact or Pattern).
- Under the Maps to column, enter the value that will be assigned to Result if the appropriate match is found. You also have the choice to provide a value for Result, if the selected data doesn't match a value on the list.
-
Once you have finished listing the values, you can use Result in an expression in the Use the result in the following expression field.
In this example the value of the application port specified in a request {{Request.Port}} is looked up to the list of matching values. If there is a match, it is mapped to a corresponding text value. Using the keyword Result in the expression, the appropriate textual mapped value will be added to a global data list called AppRequests, using the Data.GetList(Text ListName).AddMember("Text Member") method (supplied by the Data module).
- Once you have configured the item click OK to return to the worksheet.
- The Map lookup policy item will now blink, allowing you to give it a meaningful name so you can identify it easily in the policy evaluation flow.