Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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?

  • Anonymous's avatar
    Anonymous
    5 years ago

    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

     

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    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