Forum Discussion

pelowski's avatar
pelowski
Helper III
6 years ago
Solved

Filter each list within a column for lines that contain strings

I'm trying to parse out parts of an email message containing certain search terms.  I've got it to the point where I've filtered to only those messages that contains the strings I want and have it su...
  • Jimmy801's avatar
    6 years ago

    Hello pelowski 

     

    you can surround your custom function like this

    let
    	Source = #table 
    	(
    		{"Facility"},
    		{ {"This is a test"}, {"this is fantastic"}, {"Test123"}, {"13:00 am"} } 
    	),
    	Facility = List.Select
    	(
    		Source[Facility], //your custom function goes here
    	(
    		listitem
    	)=>
    	List.AnyTrue
    	(
    		List.Transform
    		(
    			{"test","1"}, //words to be searched go here
    			(
    				transfrom
    			)=>
    			Text.Contains
    			(
    				listitem,
    				transfrom,
    				Comparer.OrdinalIgnoreCase
    			)
    		)
    )
    )
     in 
    	Facility

     

    Copy paste this code to the advanced editor in a new blank query to see how the solution works. If this solution fits your need, copy and past a part of it and implement it in your query.

    If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
    Kudoes are nice too

    Have fun

    Jimmy