Set Key-Value Pair

Verb: setKeyValue

Sets a key and a value to a "Key Value Pair" type variable.

Syntax

setKeyValue --keyvalue(StringKeyValuePair<Variant>) [--key(String)] [--value(Variant)]

Inputs

Script Designer Required AcceptedTypes Description
--keyvalue Key value pair Required String Key Value Pair<Any> Variable to which the key and value are set.
--key Key Optional Text Key that should be set to the "Key value pair" variable.
--value Value Optional Any Value that should be set to the "Key value pair" variable.

Example

Set a key and a value to the variable ${keyValuePair}.

defVar --name keyValuePair --type "StringKeyValuePair<TValue>" --innertype String
defVar --name value --type String --value Mary
defVar --name key --type String --value Name
setKeyValue --keyvalue ${keyValuePair} --key "${key}" --value ${value}
logMessage --message "${keyValuePair}" --type "Info"
//Result: [Name, Mary]

Remarks

The value of both the Value and Key value pair parameters must be of the same type.

See Also

  • Assign Value to a Variable If
  • Imply
  • Set Variable
  • Set Variables