generate url if condition is met

I have 2 fields:

  • has_preview
  • Preview_url

for the Preview_url field I am using beast mode:

CONCAT('<a href=', CONCAT('https://full_url_',`presentation_id`,'.mp4 target="_blank"'), '>','Preview', '</a>')

 

I only want the 'Preview_url' field populated if 'has_preview' field has a value of 'yes'.

 

Any ideas how I can achieve this?

 

 

Tagged:

Best Answer

  • BlueRooster
    BlueRooster Domo Employee
    Answer ✓

    You should be able to do this with a BeastMode using a Case statement. This should get you close to what you need:

    CASE WHEN `has_preview` LIKE 'yes' THEN CONCAT('<a href=', CONCAT('https://full_url_',`presentation_id`,'.mp4 target="_blank"'), '>','Preview', '</a>')
    END

    With that, whenever has_preview is anything but yes, it'll return a blank value instead.

     

    Hope that helps,

    Valiant

Answers

  • BlueRooster
    BlueRooster Domo Employee
    Answer ✓

    You should be able to do this with a BeastMode using a Case statement. This should get you close to what you need:

    CASE WHEN `has_preview` LIKE 'yes' THEN CONCAT('<a href=', CONCAT('https://full_url_',`presentation_id`,'.mp4 target="_blank"'), '>','Preview', '</a>')
    END

    With that, whenever has_preview is anything but yes, it'll return a blank value instead.

     

    Hope that helps,

    Valiant

  • works like a charm!

     

    thank you!