Forum Discussion
Remove text between delimiters
- 6 years ago
Hi Anonymous ,
You can create a column with the bolded code - if you paste the full code into the advanced editor you'll have a complete solution:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcspJVIBhcx/PENcgpVidaKUkINcUzFUoSa0oARNgCaC6JAWgJFzABEkVUBdMkYKJngFCBiwaAlWiABY3NQCzkQ0GCxgZG+sZo5qpYGiA4ZRYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Product input" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product input", type text}}), #"Added Custom" = Table.AddColumn( #"Changed Type", "Custom", each Text.Combine( List.Select( Text.Split([Product input], " "), (x) => not Text.Contains(x, "liter", Comparer.OrdinalIgnoreCase)), " ")) in #"Added Custom".. unfortunately the new editor doesn't let me highlight parts of the code anymore - this is the code that goes into the "Table-Add-column-Window":
Text.Combine(
List.Select(
Text.Split([Product input], " "),
(x) => not Text.Contains(x, "liter", Comparer.OrdinalIgnoreCase)),
" ")
Anonymous ,
Perhaps it will be either a function that removes any word that "contains" Liter, or inserting a delimiter around any word that contains the same. Calling on the M language superheroes. ImkeF KenPuls .
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
- Anonymous6 years agoNot applicable
Yes such a solution would indeed do the trick!
- ImkeF6 years agoCommunity Champion
Hi Anonymous ,
You can create a column with the bolded code - if you paste the full code into the advanced editor you'll have a complete solution:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcspJVIBhcx/PENcgpVidaKUkINcUzFUoSa0oARNgCaC6JAWgJFzABEkVUBdMkYKJngFCBiwaAlWiABY3NQCzkQ0GCxgZG+sZo5qpYGiA4ZRYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Product input" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Product input", type text}}), #"Added Custom" = Table.AddColumn( #"Changed Type", "Custom", each Text.Combine( List.Select( Text.Split([Product input], " "), (x) => not Text.Contains(x, "liter", Comparer.OrdinalIgnoreCase)), " ")) in #"Added Custom".. unfortunately the new editor doesn't let me highlight parts of the code anymore - this is the code that goes into the "Table-Add-column-Window":
Text.Combine(
List.Select(
Text.Split([Product input], " "),
(x) => not Text.Contains(x, "liter", Comparer.OrdinalIgnoreCase)),
" ")- Anonymous6 years agoNot applicable
ImkeF that works perfectly, thanks so much for your help!
BTW, are there any books or courses you'd recommend to become better at writing M?
RegardsBas