so I am having a custom search form, basically the user types in a keyword and I search the collection of Persons based on his properties and if they contain the keyword.
So user types in "Berlin" and I filter all persons which contain the keyword in there property:
var filteredMedia = Model.Persons.Where(x => x.GetPropertyValue<string>("city").ToUpper().Contains(searchTerm.ToUpper())).Reverse();
So this works great with normal text string fields, but if I use the repeatable string, then I have a problem. I can't use the GetPropertyValue
I am currently fixed this by doing it the "manual" way, getting the collection and filter out the ones through two for each loops, but I am afraid that could be a bit slow.
Any Ideas how I could filter out the repeatable strings directly throught Linq?
Filtering Repeatable String Property in Linq
Hi,
so I am having a custom search form, basically the user types in a keyword and I search the collection of Persons based on his properties and if they contain the keyword.
So user types in "Berlin" and I filter all persons which contain the keyword in there property:
So this works great with normal text string fields, but if I use the repeatable string, then I have a problem. I can't use the GetPropertyValue
I am currently fixed this by doing it the "manual" way, getting the collection and filter out the ones through two for each loops, but I am afraid that could be a bit slow.
Any Ideas how I could filter out the repeatable strings directly throught Linq?
Thx!
Hi Edvin,
Repeatable text string should return an array so updating your where clause to -
I would also recommend null checking x in case someone unpublished a Person that is selected.
Matt
is working on a reply...