I have string array and integer array I want to add key and value to dictionary .
How to add key and value to dictionary from string array and integer array using for each loop.
- Declare a dictionary say Dict of type(String,Int32)
- Initialize the dictionary using an Assign activity
Dict (LeftSide) New Dictionary(of String, Int32) on the right - For Each StrVar in StringArrayVariable (Assign the Index - In the property pane to an Integer say: getIndex)
Add To Dictionary activity [Key: StrVar, Value: IntArrayVal(getIndex)]
Hi,
You can do it using the following expression, without loop, FYI.
arrStr.Zip(arrInt32, Function(k, v) New With {k, v}).ToDictionary(Function(x) x.k, Function(x) x.v)
Regards,
Thanks to you.Can you share screenshort it is giving me error of “This activity is missing or cann’t be loaded”
Thanks @Yoichi
Hi @muneeb
1.First create Dictionary object
use assign activity in_dic = new Dictionary(of String,Int)
2.Read excel data
Use Excel application scope pass the path where you save the excel file
and then use read range activity pass the sheet name create output data table variable.
3.use for each row activity pass the data table variable
and use assign activity in_dic(row(“KeyColumnName”)) = row(“Value”).
Regards,
Kommi Jeevan.
There is no row name in excel
excel contains column names or not?
Excel has no column names