Hi Team,
I am completely new to dictionary. I wanted to know how to
- Create a dictionary
- Store Address (Contains 5 lines)
- How to access the same from dictionary.
Hi Team,
I am completely new to dictionary. I wanted to know how to
Hi
lets go one by one
in variable panel create a variable named like
dict_input with datataype as System.Collections.Generic.Dictionary(string, string) and to get the type we can click on BROWSE FOR TYPE and then search this type
and default value as New Dictionary(of string, string)
to store value in it
use a SIMPLE assign activity like this
dict_input(“keyname”) = “yourvalue”
as dictionary is a pair of key and value like this
{{“key1”,“value1”},{“key2”,“value2”},{“key3”,“value3”},{“key4”,“value4”},{“key5”,“value5”}}
we can mention the key name in left side and value in right side of assign activity
then finally
to access them
in writeline activity like this
dict_input(“keyname”).ToString
hope this would help you
Cheers @Robotics
I extracting the address as below
ForEach [Item] in [NameSplit]
How to add the above in dict_input(“keyname”) = “yourvalue”?
I have declared as in Argument
out_dict - out - Dictionary<String,String>
Let me know where do i need to do the changes ?
Hey @Robotics (what a cool name )
@Palaniyappan explained the use of dictionairy perfectly. I just want to add that there is a workflow in the ReFramework (InitAllSettings.xaml) that creates a dictionairy from values stored in an excel file (usually called Config).
And because this came up before today: you can also store more than one value per key in a dictionairy
Cheers, Lukas
in a ASSIGN activity
Cheers @Robotics
I am asking how to do in assign activity.
out_dict = item ?
fine if you want to store your name in the dictionary variable created
then in assign activity
dict_input(“Name”) = “Robotics”
where dict_input is a variable of type System.Collections.Generic.Dictionary(of string, string)
and similarly if we want to save the place you born
then in assign activity
dict_input(“Place”) = “USA”
so now if you want to access the name value in a writeline then mention like this
dict_input(“Name”).ToString
Cheers @Robotics
Based on the above syntax i am not getting any error but getting the same output. Let me elaborate what i have done so far.
we need to create this dictionary before the for each loop
else it will create new dictionary for every loop thats the issue
Cheeers @Robotics