Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Highlighted
Not applicable

Replace particular values in table in load script

Hi All,
Im sure theres a smart piece of load script out there to achieve the following better than i am currently.
What i want to do is effectively Find and Replace values in a field, with new values, if the existing values can be found in a particular field of a different table. Example below.
What i have as data currently is shown below;
FIELD AFIELD B
AAACustomer A
BBBCustomer B
CCCCustomer C
DDDCustomer D
CCCCustomer C
DDDCustomer D
What i want to do is replace all of the values in 'FIELD A' that are currently CCC with YYY, and also all those that are DDD with ZZZ.
So the end result table is as follows;
FIELD AFIELD B
AAACustomer A
BBB
Customer B
YYYCustomer C
ZZZCustomer D
YYYCustomer C
ZZZCustomer D
I would, ideally, like to manage which field values to update, and what to update them with, using another table (excel/cvs etc.). So that table might look like the following;
FIELD A (old)FIELD A (new)
CCCYYY
DDDZZZ
Ovicously i can do this with an IF() statement in the load script but there are a few values that need replacing so i'd like to manage them outside the load script itself in a seperate table file (excel or csv etc).
Does anyone have a simple solution to this?
Thanks in advance.
1 Reply
MVP & Luminary
MVP & Luminary

Re: Replace particular values in table in load script

You can use a Mapping load to create a map and then use either "map using" or applymap() to modify fielda.

Rob