HI All,
I have one Checklist={Monday@123;Tuesday@123;Friday@123}
and Originaldictionary=
{Monday@123 , “empty”}
{Monday@123;Tuesday@123,“empty”}
{Friday@123,“empty”}
{Sunday@123,“empty”}
Output required in dictionary:
{Monday@123 , “found”}
{Monday@123;Saturday@123,“found”}
{Friday@123,“found”}
{Sunday@123,“empty”}
i.e if any list item is found in dictionary then , value of that key in dictionary need to be updated.
currently using
but dictionary is not properly updated as per the expected output
Any help will be appreciated @ppr @Gokul001 @Nithinkrishna @Palaniyappan
Hey @TUSHAR_DIWASE
For-Each item in List
If dict.ContainsKey(item)
dict(item) = "Found"
Else
//Do Nothing
End For-Each
Hope this pseudo code helps.
Thanks
#nK
This does not work when dictionary key contain ; .
{Monday; Saturday,“any value” }
Robot not able to update value for above key.
As in list item value = Monday so it look for Monday key only to update its value.
Okay @TUSHAR_DIWASE I was not aware of this.
Kindly try this.
For-Each item in List
If dict.Keys.Any(Function(obj) obj.ToString.Contains(item))
dict(item) = "Found"
Else
//Do Nothing
End For-Each
Hope this helps. If you want to cover any other variations also please let us know.
Thanks
#nK
Thanks for the reply but above solution didn’t update value in dictionary when key has ;
For example: item value in list is Monday.
Dictionary has key as
“Monday; Friday”
“Monday”
Above solution will satisfy if condition and update only key “Monday” not “Monday;Friday” .
I have mentioned input and expected output in initial discription
Hi @TUSHAR_DIWASE ,
Assuming you have a List/Array of String as the Checklist and the Dictionary you want to update based on the checklist, then Could you try the below expression. You would not need to use For Each Loops :
Just an Assign Statement :
dictEmail = dictEmail.ToDictionary(Function(x)x.Key,Function(x)if(listWords.Any(Function(y)x.Key.Contains(y)),"Found",""))
Here dictEmail is your Dictionary to be updated and listWords is the checklist array.
Let us know if you are facing issues.
I hope @TUSHAR_DIWASE you are using the above updated condition which should cover the scenario you mentioned.
Thanks
#nK