About Dictionary

The Dictionary is a collection of Keys and Values, where key is like word and value is like definition.

Thus, The Dictionary class is a general collection of keys and values pair of data.

Important Points:

The Dictionary class implements the IDictionary<TKey,TObject> Interface.

User can store the values in any defined data type in value.

About Dictionary activity in Robility

One can add, delete, set, get and view a dictionary, using the corresponding activities that are available in the SmartDesigner under the Dictionary header.

Add

Let us proceed to add a dictionary. Drag and drop an Add activity from the dictionary package. 

1

Figure 1

The next step is to create a variable. Select browse for types.

1

Figure 1.1 Variable creation

System.Collections.Generic namespace is a generic class and can store any data types in a form of keys and values. Each key must be unique in the collection.

Define the dictionary name in the Name Field and select the subsequent supporting  class name.  Select argument type 1 and type 2 as per requirements. String and Int32, respectively.  The same argument types are to be provided in the property window parameters in the activity.

2

Figure 2 Type Name

In the property window, provide the Input, such as Dictionary Name, Key and Value. Select the Argument types and ensure it is similar to the ones selected in the dictionary string; under the variable type.


3

Figure 3 Property Window Input

Dictionary Viewer

Drag and drop a Dictionary Viewer and fill the input fields in the property window. Select the expiry seconds before the viewer closes. Provide a message title and arguments types selected in the Add dictionary activity.  Execute.

4

Figure 4 Dictionary Viewer

Users can view the Key and its corresponding values.

5

Figure 5 View

One can add more keys and  pertaining values in the same dictionary, through another add activity.

6

Figure 6 Multiple Dictionaries

It can be viewed through the Dictionary Viewer, just like in the first instance.

7

Figure 7 Dictionary View

Note: Multiple variables can be created under one key.  Choosing object in the argument type will enable one to store all data types in the variable.

Dictionary cannot include duplicate or null keys, whereas, values can be duplicated or set as null. Keys must be unique, otherwise it will throw a runtime exception.

 

 

v5.0.0