Dictionary Command

 RPA | Dictionary Command | Automation Anywhere - Part-12


Dictionary Command | The Dictionary command works on key-value pair concept. It is used to provide actions to perform Dictionary operations. You need to have Dictionary package installed before using the Dictionary command. Some of the points to be noted while working with Dictionary command are as follows:-

  • Keys are unique within each dictionary variable. If we try to duplicate a key, we will overwrite its value.
  • The names of the key cannot be changed.
  • The keys are case-sensitive in nature and cannot contain a dollar($) sign.
  • The keys do not have a leading or trailing whitespaces.
  • The key-value pair are separated by a colon. Each key-value pairs are separated from each other by a comma.
Example of Dictionary is as follows:-

invoice = {'CustomerID': 1234, 'Location': 'XYZ', 'Amount': 12,34,567}.

Supported Variable Manager operations:
  • Add a key.
  • Add a key and a value pair.
  • Edit a key.
  • Edit a value for a key.
  • Delete a key and the associated value.
  • Delete a key.

If reinitialization of an existing dictionary fails then the previous key-value data of the dictionary is preserved.


The Dictionary command provides various sub commands which are as follows:-

  1. Assign Command - This command is used to assign the value of the source dictionary variable to the destination dictionary variable. 
  2. Get Command - This command is used to return the value associated with the key in the Dictionary. 
  3. Put Command - This command allows user to see and insert dictionary variables.
  4. Remove Command - This command allows user to see and remove dictionary variables.Basically through this command we can remove as many dictionary variables we have created in our process.
  5. Size - This command is used to return the number of entries in the Dictionary.

Now let's take a look at the code snippet of how to use various dictionary commands in our code as follows:-





If you have any queries regarding the Dictionary command then please feel free to reach out to me by posting your queries in the comment section and i would be more than happy to answer your queries.   



Comments

Post a Comment

If you have any doubts, please letme know.