Support > Forums > OpenBots Studio > Get a specific Dictionary Key instead of Value

Get a specific Dictionary Key instead of Value

Rotfcoy

  • Reporter
  • Calender Icon April 23,2021 at 4:51 AM

I would like to get a Key from a specific Key Value Pair from the Dictionary I created. There is this error message ("Invalid Dictionary Value Type") when i use this command "Get Key from KeyValuePair". Any idea how to do it?

This forum has 314 topics, 681 replies, and was last updated 8 days ago by Support Agent

Nataly Alvarado...

  • Participant
  • Calender Icon April 23,2021 at 2:30 PM

Hello,

In order to get the key from a specific Key Value Pair, it is important to first obtain the KeyValuePair wanted from the dictionary (this can be done by looping through the collection). Then, this can be used as input for the Get Key from KeyValuePair command. The Get Key from KeyValuePair command requires the following fields:

  • KeyValuePair - Requires a KeyValuePair'2 type variable. You need to create this variable before using the command. Also, the key value pair variable needs to be populated. You can do so by using the Loop Collection command to loop through the dictionary and storing the output collection item to the key value pair variable.
  • <li>Output Key Variable - Requires a string type variable in which the key for the specified key value pair will be saved.</li>
    

Hope this helps!

You are not authorized to reply, please click here to login and add your reply to this topic.