Hi Team,
I have a list of dictionaries like
as expression:
{
{name: "Aish", category: "A"}
{name: "Jenny", category: "A"}
{name: "Corie", category: "C"}
{name: "David", category: "E"}
{name: "Daniel", category: "E"}
}
So now I need a code to run on this list of dict. to get only those who have Category of E.
Can anyone help me with the approach/code?
Thanks in Advance
Discussion posts and replies are publicly visible
Hi arshbirs0001,
The below code should do what you want. local!dictionary is the variable containing your dictionary
index( local!dictionary, wherecontains( "E", touniformstring(property(local!dictionary,"category","")) ) )
Please also tell What if I want to filter with multiple conditions? like I want category A and E both
arshbirs0001, for the next iterations with Community I suggest you open different threads for the different question since it will help colleagues to better use your topic in the future.
Nothing prevents you to use a!forEach (quite powerful) to do what you need. I advise you to check the filter() function as well. You can define a helper function that you can use to filter a list
a!forEach( items:local!dictionary, expression: if( or(property(fv!item,"category")="A", property(fv!item,"category")="E"), fv!item,{} ) )
arshbirs0001, did this work for you? If so, I would appreciate if you could close it by marking the above as an answer.
thanks