New Dictionary(Of String, String()) from{{“1”,{“Jan”,“Feb”,“Mar”}},{“2”,{“Apr”,“May”,“Jun”}},{“3”,{“Jul”,“Aug”,“Sep”}},{“4”,{“Oct”,“Nov”,“Dec”}}}
by using Feb value i want to take key as 1
New Dictionary(Of String, String()) from{{“1”,{“Jan”,“Feb”,“Mar”}},{“2”,{“Apr”,“May”,“Jun”}},{“3”,{“Jul”,“Aug”,“Sep”}},{“4”,{“Oct”,“Nov”,“Dec”}}}
by using Feb value i want to take key as 1
Hi,
you may try the following:
string month = “Feb”
string key = dict.FirstOrDefault(function(x) x.value.Count(function(y) y=month)>0).Key
Cheers
@brindhaS @J0ska
Because inner element is again an array, instead of accessing each element and comparing, you can directly use Array.Contains(element) expression as below -
dictData.FirstOrDefault(function(x) x.Value.Contains()).Key.ToString
im getting error in giving in assign activity
@brindhaS what is the error you are getting? Can you share the screenshot please
hi, I have a New Dictionary(Of String, String) from {[ToyPoodle,Poodle], [TinyPoodle,Poodle]} (2 keys, same value). How to get the key when using value Poodle?
@tranthao240495
Dictionary will not let you to add two values with same key. can you please recheck your dictionary keys.
No, I have 2 different keys but same value
You can use yourDictionary(“yourKey”)
you can try this
for key in dictionary.keys
if dictionary(key).contains(“Feb”)
return key