Get Dictionary Value
Verb: strDictGet
Gets the value corresponding to an existing key in a string dictionary.
Syntax
strDictGet --key(String) --dictionary(StringDictionary<Variant>) (Variant)=value
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --key | Key | Required | Text | Key of which the value should be obtained. |
| --dictionary | Dictionary | Required | String Dictionary<Any> | String dictionary from which the value should be obtained. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| value | Value | Any | Returns the value obtained from the string dictionary associated to the key specified in the Get Dictionary Value parameter. |
Example
Gets the value "Austin" from the "City" key contained in the string dictionary.
defVar --name stringDictionary --type StringDictionary --innertype String
defVar --name obtainedValue --type String
// The command "strDictAdd" is used to add "City" and "State" to Key and "Austin" and "Texas" to Value separately in the text dictionary.
strDictAdd --key City --value Austin --dictionary ${stringDictionary}
strDictAdd --key State --value Texas --dictionary ${stringDictionary}
logMessage --message "Items added to the string dictionary: \r\n${stringDictionary}" --type "Info"
// The command "strDictGet" is used to get the "City" Key Value from the text dictionary.
strDictGet --key City --dictionary ${stringDictionary} obtainedValue=value
logMessage --message "Value obtained from string dictionary: ${obtainedValue}" --type "Info"
// Returns the following output:
// Items added to the text dictionary:
// [City=Austin, State=Texas]
// Value obtained from the text dictionary: Texas.