Forum Discussion

ValeriaBreve's avatar
ValeriaBreve
Post Partisan
2 years ago
Solved

List.FindText with items from a list?

Hello, I have 2 lists: ListData ListFilter both containing text strings. I would like to find any item in ListData that contains any part of a string from ListFilter. ex. ListData: {"red apple...
  • ronrsnfld's avatar
    2 years ago

    Another approach, using List.Accumulate to cycle through the ListFilter:

    let
        ListData= {"red apple", "blue apple", "green banana", "red pear"},
        ListFilter={"apple","pear"},
        filter = List.Accumulate(
            ListFilter,
            {},
            (s,c)=> s & List.FindText(ListData,c))    
    in
        filter