Expand my Community achievements bar.

SOLVED

Replace function in query editor

Avatar

Level 2

Hi,

i would like to replace the first two characters (value is always '33') of a text field with the value '0'. I tried the replace function with a left function inside -> Replace(Field, Left(Field, 2), '0') and i also tried it with a substring function -> Replace(Field (Substring(Field, 1, 2)),'0'). The first case throws an error, the second one works, but it does replace all '33' values in the field and i need it to replace only the first two characters.

Thank you so much in advance for helping out or sharing your ideas on this.

Regards,

Malte

1 Accepted Solution

Avatar

Correct answer by
Level 5

I think this should work-

'0'+Substring(field, 3, dataLength(field)-2)

Thanks!

View solution in original post

3 Replies

Avatar

Correct answer by
Level 5

I think this should work-

'0'+Substring(field, 3, dataLength(field)-2)

Thanks!

Avatar

Level 2

Hi,

thank you for helping, but i think i was not expressing myself clear enough, sorry. I only would like to replace the first two characters, if the value is '33' as condition. Would that work as a part of a case when function?

Thank you!

Avatar

Level 2

And what does the datalenght function do with datalenght(field)-2. Does it produce all the characters of the field minus the first two of them?

Thank you