Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Irisohyama6
Frequent Visitor

How to check list of string contains list of specified special characters

I want to check whether my list (column 1-3) contains the specified special characters (List). I added custom column with the M code below, somehow it returns False but you can clearly see there is special characters in the strings. 

 

Thanks for help.

 

Table

Column1Column2Column3Custom

I have an applethe apple is greenI love appleFALSE
duwhbgi*ubnh()FALSE
uhr??ihHUij/jiUHub\FALSE
qw|wqeqe<>wd\FALSE
qwedEWDFqrARFtFALSE

 

ASCII_List

List

"
\
/
:
?
|
*

 

M Code

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("PY1BCsIwEEWvMmSlUrDgAYqgpd0KxUWSRWKGJqXEJjbNxsM7reJqHu99GM5ZC1YtCMqDmqYRWcFmi18G94I+InqSLYzP5eeZLDgzKVvyuncHOkl7u9tvIdlYVW5tTeeG4+CIuiZpIbYc8juH9U1Akcry9CDcALP5T9CQvd4vdYgE51s9Myk/", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, Column2 = _t, Column3 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each List.ContainsAny({[Column1],[Column1],[Column1]},{ASCII_List[List]}))
in
    #"Added Custom"

 

 

2 ACCEPTED SOLUTIONS
wdx223_Daniel
Super User
Super User

is this what you want?

wdx223_Daniel_0-1656995727342.png

 

View solution in original post

v-eqin-msft
Community Support
Community Support

Hi @Irisohyama6 ,

 

Please add a column by using:

[
    comb=[Column1]&[Column2]&[Column3],
    f=List.ContainsAny(Text.ToList(comb) ,ASCII_List) 
][f]

Eyelyn9_0-1657171330501.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-eqin-msft
Community Support
Community Support

Hi @Irisohyama6 ,

 

Please add a column by using:

[
    comb=[Column1]&[Column2]&[Column3],
    f=List.ContainsAny(Text.ToList(comb) ,ASCII_List) 
][f]

Eyelyn9_0-1657171330501.png

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

wdx223_Daniel
Super User
Super User

is this what you want?

wdx223_Daniel_0-1656995727342.png

 

Nathaniel_C
Super User
Super User

Hi @Irisohyama6 ,

Working on this, and thank you for the M code...I did notice Column1 is the only value.


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks for that @Nathaniel_C . I changed it, but still the same result too.

 

 

Hi @Irisohyama6 ,

Sorry, am stumped.  Think it will be changing the column to a list.  However let us call on the m code gurus @ImkeF and @KenPuls 
Good Luck!

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors