How to use Escape characters in Beast Modes?

Hi, I am trying to create a web link for a card using a beast mode and some of the values that will be passed through the beast mode contain apostrophes ' . When they are passed through the beast mode the link is broken because the value is cut off early.

For example the value 'Square's Lake' is cut off early and ends up being 'Square' because the second ' makes Domo see it as the end of a value. Note: the first and last ' are what is used to declare a value, for a case statement in this instance.

Is there a way to make note of an Escape Character like ' in a beast mode and ensure that Domo will not see this as the end of a value?

I've seen the doubled ' ' method but that doesn't seem to be working.

Has anyone had experience with this issue or found a way around it?

Tagged:

Answers

  • GrantSmith
    GrantSmith Indiana 🥷

    What does your HTML / beastmode code look like?



    **Was this post helpful? Click Agree or Like below**

    **Did this solve your problem? Accept it as a solution!**
  • This is the initial version.

    CONCAT('<a href=''https://woodpartners.domo.com/page/437192974?pfilters=['


    ,'{"column":"Comp For","dataType":"string","operand":"IN","values":["'

    ,`Comp For`

    ,'"]}'

    ,']'' target="_blank" title="Open in Domo">','Click here for Weekly Export','</a>'

    ) end

    Domo


    [Yesterday 1:23 PM] Bhatia, Ritwik

    Not working when our property (value) has an apostrophe (Square's Lake)

    I then tried editing in and this is what I ended up with by trying to use an escape character in the name Square's Lake.


    case when `Comp For` = 'Square''s Lake' then


    CONCAT('<a href=''https://woodpartners.domo.com/page/437192974?pfilters=['


    ,'{"column":"Comp For","dataType":"string","operand":"IN","values":["'

    ,'Square''s Lake'

    ,'"]}'

    ,']'' target="_blank" title="Open in Domo">','Click here for Weekly Export','</a>'

    )


    else


    CONCAT('<a href=''https://woodpartners.domo.com/page/437192974?pfilters=['


    ,'{"column":"Comp For","dataType":"string","operand":"IN","values":["'

    ,`Comp For`

    ,'"]}'

    ,']'' target="_blank" title="Open in Domo">','Click here for Weekly Export','</a>'

    ) end

  • GrantSmith
    GrantSmith Indiana 🥷

    I'd try and use some URL encoding for your pfilters value as that's likely what's causing the issues with the quotes not working. You can refer to https://domohelp.domo.com/hc/en-us/articles/360043430113-Sample-Beast-Mode-Calculations-Miscellaneous-Transforms#5.

    Also you can use a website to do the URL encoding of your strings like http://urlencoder.org



    **Was this post helpful? Click Agree or Like below**

    **Did this solve your problem? Accept it as a solution!**