cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ashaikh-its
Helper II
Helper II

Remove additional character in HTML

Hello All,

 

I have a column that is in HTML format. I would like to keep the column as HTML and display HTML in my report. But I have additional characters "&?". I want to remove this additional column from the HTML value.

 

I am trying this function to remove the additional characters - 

(HTML as text) =>
let
    Source = Text.From(HTML),
    SplitAny = Text.SplitAny(Source,"amp;?"),
    ListAlternate = List.Alternate(SplitAny,1,1,1),
    ListSelect = List.Select(ListAlternate, each _<>"&"),
    TextCombine = Text.Combine(ListSelect, " ")
in
    TextCombine

I am using this function in  my actual table

#"HTML Cleanup" = Table.AddColumn(#"Promoted Headers", "NewColumn", each
        if [ExistingColumn] = null
            then null
        else #"HTML Cleaner"([ExistingColumn]))

The additional character is showing up in a link - 

https://abc.com/a/sr/attach/rkm/3023/23378?server=xyz&amp;?timestamp=1585154001466

 

Can you provide any help in modifying the query or any other suggestion of how can I achieve this?

1 ACCEPTED SOLUTION
ashaikh-its
Helper II
Helper II

Made following change in the script and it worked.

 

 

(HTML as text) =>
let
    Source = Text.From(HTML),
    SplitAny = Text.Split(Source,"amp;?"),
    ListAlternate = List.Alternate(SplitAny,1,1,1),
    ListSelect = List.Select(ListAlternate, each _<>"&"),
    TextCombine = Text.Combine(ListSelect, " ")
in
    TextCombine

 

View solution in original post

3 REPLIES 3
ashaikh-its
Helper II
Helper II

Made following change in the script and it worked.

 

 

(HTML as text) =>
let
    Source = Text.From(HTML),
    SplitAny = Text.Split(Source,"amp;?"),
    ListAlternate = List.Alternate(SplitAny,1,1,1),
    ListSelect = List.Select(ListAlternate, each _<>"&"),
    TextCombine = Text.Combine(ListSelect, " ")
in
    TextCombine

 

View solution in original post

ashaikh-its
Helper II
Helper II

@omtinole hello I found the sample query in one of the posts. Would you be able to help me out?

Hi @ashaikh-its ,

 

Would you please try to use the following m-query?

 

(HTML as text) =>
let
    Source = Text.From(HTML),
    SplitAny = Text.SplitAny(Source,"<>"),
    ListAlternate = List.Alternate(SplitAny,1,1,1),
    ListSelect = List.Select(ListAlternate, each _<>""),
    TextCombine = Text.Combine(ListSelect, "")
in
    TextCombine

 

Please refer to the similiar post: https://social.technet.microsoft.com/Forums/office/en-US/b080d122-14f0-43bc-8a86-f50cdf1c32d8/removi...

 

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

 

Best Regards,

Dedmon Dai

Helpful resources

Announcements
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Get Ready for Power BI Dev Camp

Power BI Dev Camp - June 24th

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors