Use Properties with Map Type Lists
There are several properties for working with Map Type lists. Using these properties in rule criteria, you can retrieve information about a Map Type list, modify a list, create a new list, and also convert a list into a string.
To retrieve information about a Map Type list (map), you can:
- Retrieve a map that you specify a name for
- See whether a particular key exists within a map
- Retrieve the number of key-value pairs in a map
- Retrieve a list of the keys in a map
- Retrieve the value for a given key in a map
The following properties are used to perform these activities.
Property | Description |
---|---|
Map.ByName |
Provides a map with the name that you specified. |
Map.HasKey |
Is true if the specified map includes the specified key. |
Map.Size |
Provides the number of key-value pairs in a map. |
Map.GetKeys |
Provides a list of the keys in a map. |
Map.GetStringValue |
Provides the string that is the value of the specified key in the specified map. |
You can, for example, use the Map.GetStringValue property in the criteria of a rule to see whether a key in a list has a particular value. The key could be a user name and the value a string that serves as a token for authentication.
The criteria would then be configured as follows:
Map.GetStringValue (testmap, "sampleuser") equals "sampletoken"
If the sampleuser key has sampletoken as its value, the criteria matches, and the rule executes a particular action, for example, Continue.
When a map is modified, the modification is applied to a copy of the original map, while the original map itself remains unmodified. To modify a map in this way, you can:
- Set a key to a particular value
- Delete a key
The following properties are used to perform these activities.
Property | Description |
---|---|
Map.SetStringValue |
Provides a map in which the specified value is set for the specified key. |
Map.DeleteKey |
Provides a map in which the specified key is deleted. |
To create a new map or convert a map into a string, the following properties are used.
Property | Description |
---|---|
Map.CreateStringMap |
Provides a new map, which is still empty. |
Map.ToString |
Provides a map converted into a string. |