3 Replies Latest reply on Aug 14, 2018 12:37 PM by Soham Wadekar

    Use contains and replace function

    theresa.wallace.0

      Hi There,

       

      I have am looking to create a calculated field where the text after 'clk' is replaced with 'placeholder'. The problem is that these are counted as separate results when they should be summed together.

       

      Currently showing as

      Textvalue
      btn-clk-autoservice-car-insurance5
      btn-clk-wellness-car-insurance10
      btn-clk-carservice-rental-move7
      btn-clk-travel-rental-move3

       

      Wanted result

      Textvalue
      btn-clk-placeholder-car-insurance15
      btn-clk-placeholder-rental-move10

       

       

      The function I was working on was a contains within an if statement but got stuck with the multiple variations. Anything you can do to help would be great appreciated!!

       

      IF CONTAINS([Text], "autoservice")

      THEN (REPLACE(ATTR([Text]),"autoservice", "placeholder")

      OR

      CONTAINS([Text], "wellness")

      THEN (REPLACE(ATTR([Text]),"wellness", "placeholder")

      OR

      CONTAINS([Text], "careservice")

      THEN (REPLACE(ATTR([Text]),"carservice", "placeholder")

      OR

      CONTAINS([Text], "travel")

      THEN (REPLACE(ATTR([Text]),"travel", "placeholder")

      ELSE 0

      END

       

      Thank you!!!