ConfigFile Dictionary In Excel

What is Wrong With This ConfigFile

Main.xaml (8.6 KB)

Excel File :-
Books List.xlsx (16.5 KB)

This excel file should be dynamic and stored the data in Dictionary
( If i take another Excel File The program will work and if i change the excel file data it will change according to that )

How can we Change Dictionary (" Object, Object ") as (“String, String”)

Hii @Krishan_Rapswal ,
Give try to this one

AddingToDictionary.zip (1.8 KB)

image

Regards,

Instead of using add to dictionary activity (Which is currently unavailable in UiPath) You can just add the values to your dictionary by using an assign activity

  1. Create a variable NewDictionary of Type : System.Collections.Generic.Dictionary<TKey, TValue>
  2. While creating dictionary variable you can provide TKey as String type and TValue as Object type which wil become Dictionary<String,Object>
  3. Now You read the data from the excel and iterate using for each row in Datatable activity
  4. Inside for each loop drap and drop assign activity
  5. NewDictionary(CurrentRow("Author).ToString)=Currentrow(“Average of rating”).To String

Now after the loop completes whichever key you provide you will get the corresponding value
Refer the xml I have shared for your reference

Regards,

Hi,

FYI, in this case, we can easily create dictionary from datatable using LINQ as the following.

dict = Input.AsEnumerable.ToDictionary(Function(r) r("Author").ToString,Function(r) r("Average of rating").ToString)

note: dict is Dictionary<string,string> type
Input is datatable from excel worksheet

Regards,

How to Change IDictionary <Object, Object> to , <String, String>

Not Getting anything (I want to store my Excel File in Dictioinary and Configure It )

Hi,

How did you check it? Can you try to set breakpoint after the Assign, then check content of dictionary in Local panel?

Regards,

@Krishan_Rapswal
Go to variables panel
Click Browse for types in the variable type column

Now Type Dictionary< You will get this below option now select string,string

image

@Krishan_Rapswal ,
drag and drop a log message outside the for each loop and put a brakpoint to it now in the immediate section provide any value for example
NewDictionary(“Fyodor Dostoevsky”)

You should be able to get the value as 4.3 (as per your input excel)

You can even check the NewDictionary Variable aswell

Regards,

1 Like

Books List.xlsx (18.0 KB)

Hello Friends,

How I Make My Excel Sheet Dynamically Through So The Other Person Can Change The Data from His Personnal Excel Sheet (Using Dictionary)

For Example I have 100 rows in my Excel File but Today he need Only 60 rows With Above Rating “4”
Next day if he wants 30 rows With Above Rating “4.1”

but he is using “His Excel File” to change the Data

Hii @Krishan_Rapswal ,
I have added the input dialogue box to the below workflow where you can provide the average of rating so that it will return only the equal or above that rating.
FilterExcel.zip (2.5 KB)

I believe this resolves your issue. If it meets your requirement.You can mark this as solution and close the topic since many duplicate posts have been created .

Hope this helps, :slightly_smiling_face:

1 Like

Hello,

Books List.xlsx (16.6 KB)

  1. In my excel file i create a excel sheet in which i want to change rows according to requirement mean to say if i want 50 rows today then it will show me 50 rows and tommorow if i need 80 rows then it will give me that data.

  2. In Another sheet i want adjust the rows according to rating Means if i want above 4 rating then it will show that

this should be dynamically (Using Dictionary)

last Condition **

IF i have another Excel file completly different the program will act according to that.

I am New and learning UiPath and i don’t know what to do please help
i have gone through many forum but didn’t find anything, searched Youtube and Google also and
I am sorry for this mess up

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.