Replace function in query editor

Avatar

Avatar
Boost 1
Level 1
malter68240968
Level 1

Like

1 like

Total Posts

9 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
malter68240968
Level 1

Like

1 like

Total Posts

9 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
malter68240968
Level 1

02-12-2019

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 5
Level 4
prasannakumarmarru
Level 4

Likes

51 likes

Total Posts

59 posts

Correct reply

17 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile

Avatar
Give Back 5
Level 4
prasannakumarmarru
Level 4

Likes

51 likes

Total Posts

59 posts

Correct reply

17 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile
prasannakumarmarru
Level 4

02-12-2019

I think this should work-

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

Thanks!

Answers (2)

Answers (2)

Avatar

Avatar
Boost 1
Level 1
malter68240968
Level 1

Like

1 like

Total Posts

9 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
malter68240968
Level 1

Like

1 like

Total Posts

9 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
malter68240968
Level 1

04-12-2019

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

Avatar

Avatar
Boost 1
Level 1
malter68240968
Level 1

Like

1 like

Total Posts

9 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
malter68240968
Level 1

Like

1 like

Total Posts

9 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
malter68240968
Level 1

04-12-2019

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!