Problem with variable - IReadOnlyCollection without for each

Hello, I have problem with variable - IReadOnlyCollection.
For example I have variable Respondents - IReadOnlyCollection as below

ReadOnlyCollection(4) {
Respondent { AdditionalProperties=Dictionary<string, object>(0) { }, AnswerPostponed=0, ContactId=1, Token=“A” },
Respondent { AdditionalProperties=Dictionary<string, object>(0) { }, AnswerPostponed=0, ContactId=2, Token=“B” },
Respondent { AdditionalProperties=Dictionary<string, object>(0) { }, AnswerPostponed=0, ContactId=3, Token=“C” },
Respondent { AdditionalProperties=Dictionary<string, object>(0) { }, AnswerPostponed=0, ContactId=4, Token=“D” },
Respondent { AdditionalProperties=Dictionary<string, object>(0) { }, AnswerPostponed=0, ContactId=5, Token=“E” },

and for example I would like to display value of Token where ContactId=3. How can I do this in a simple way without use For each activity.

give a try at:

assign Activity:
strToken =

YourReadOnlyCollectionVar.Where(Function (x) x.ContactId.Equals(3)).Select(Function (x) x.Token).FirstOrDefault()

for such prototyping we can use the debugging panels
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

1 Like

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