Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
reivax31
Partner - Creator III
Partner - Creator III

replace partialy field values

Hi Qlikers,

I would like to know if there is a way to replace partialy some field values. Let say I have a column A that I load, but during load if the value is like '*test*' then "test" hase to be replaced by "OK".

LOAD

if (A like '*test*', ...'OK'... ) AS A

From...

So if value is " this is a test" I would like to have the following result: "this is a OK"

Thanks for your help

1 Solution

Accepted Solutions
awhitfield
Partner - Champion
Partner - Champion

Hi Xavier,

check out the replace function as shown below

Andy

Replace - script and chart function

Replace() returns a string after replacing all occurrences of a given substring within the input string with another substring. The function is non-recursive and works from left to right.

Syntax:

Replace(text, from_str, to_str)

Return data type: string

Arguments:

ArgumentDescription
textThe original string.
from_strA string which may occur one or more times within the input string text.
to_strThe string that will replace all occurrences of from_str within the string text.

View solution in original post

5 Replies
awhitfield
Partner - Champion
Partner - Champion

Hi Xavier,

check out the replace function as shown below

Andy

Replace - script and chart function

Replace() returns a string after replacing all occurrences of a given substring within the input string with another substring. The function is non-recursive and works from left to right.

Syntax:

Replace(text, from_str, to_str)

Return data type: string

Arguments:

ArgumentDescription
textThe original string.
from_strA string which may occur one or more times within the input string text.
to_strThe string that will replace all occurrences of from_str within the string text.
Anonymous
Not applicable

may be this?

Replace(FieldName, 'test', 'OK')

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You can also look the mapping function.

Mapping functions like "Apply Map" and "MapSubstring" will be used to replace whole or part of the word with new word.

Look at the Help content for detail information and example.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Colin-Albert

A Mapping Table & ApplyMap is the best option.

This blog shows how to use ApplyMap  Don't join - use Applymap instead

reivax31
Partner - Creator III
Partner - Creator III
Author

Great!  the replace function worked perfectly.