Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

reivax31
Contributor 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
Esteemed Contributor

Re: replace partialy field values

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.
5 Replies
awhitfield
Esteemed Contributor

Re: replace partialy field values

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.
balrajahlawat
Esteemed Contributor

Re: replace partialy field values

may be this?

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

Re: replace partialy field values

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

Re: replace partialy field values

A Mapping Table & ApplyMap is the best option.

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

reivax31
Contributor III

Re: replace partialy field values

Great!  the replace function worked perfectly.