Skip to main content
Solved

Removing HTML code in the beginning of text

  • February 7, 2022
  • 4 replies
  • 69 views

Forum|alt.badge.img+8

Hey Guys!
Im trying to remove a text in the beginning from a lookup field, by formula.
The text starts with "<div class="vaning"></div><div class="namn">" and I want to remove “<div class="vaning"></div>” in the beginning.
I tried with the replace formula but only get error messages, does anyone know why?
For example:
REPLACE({field name}, 1, 26, “”)
Thanks J

Best answer by JonathanBowen

Hi Jonathan
It works on an ordinary textfield as you mentioned, but not on a Lookup field and I don’t know how to get around that?


Ah, OK, this ie because the lookup field is an array not a string. What you need to do is turn the lookup field into a string, then it will work fine. So:

REPLACE(Lookup & '', 1, 26, '')

Joining the Lookup field with an empty string will convert the array to a string, then REPLACE can do its work.

4 replies

JonathanBowen
Forum|alt.badge.img+18
  • Inspiring
  • 1110 replies
  • February 7, 2022

Your formula works fine for me, although check you are not inserting formatted quotes (just use plain text quotes).

REPLACE(Name, 1, 26, '')


Forum|alt.badge.img+8
  • Author
  • Known Participant
  • 38 replies
  • February 7, 2022

Your formula works fine for me, although check you are not inserting formatted quotes (just use plain text quotes).

REPLACE(Name, 1, 26, '')


Hi Jonathan
It works on an ordinary textfield as you mentioned, but not on a Lookup field and I don’t know how to get around that?


JonathanBowen
Forum|alt.badge.img+18
  • Inspiring
  • 1110 replies
  • Answer
  • February 7, 2022

Hi Jonathan
It works on an ordinary textfield as you mentioned, but not on a Lookup field and I don’t know how to get around that?


Ah, OK, this ie because the lookup field is an array not a string. What you need to do is turn the lookup field into a string, then it will work fine. So:

REPLACE(Lookup & '', 1, 26, '')

Joining the Lookup field with an empty string will convert the array to a string, then REPLACE can do its work.


Forum|alt.badge.img+8
  • Author
  • Known Participant
  • 38 replies
  • February 7, 2022

Ah, OK, this ie because the lookup field is an array not a string. What you need to do is turn the lookup field into a string, then it will work fine. So:

REPLACE(Lookup & '', 1, 26, '')

Joining the Lookup field with an empty string will convert the array to a string, then REPLACE can do its work.


Yes that works great, just found that if I do a Rollup field instead, the original formula works as well.
Thank you for your advice.
Jesper