Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
karan_kn
Creator II
Creator II

Conditional renaming of multiple field values in load script

I need to rename multiple values from the screenshot, we can use if condition for limited conditions like below, and can someone help how we could do this for multiple cases.

If(Type='A2' and Subtype='DDD002' and Category='Brand' and Code='clk_standard-2584-y21', 'A-High', Type AS [Type New]

If(Type='A2' and Subtype='DDD002' and Category='Brand' and Code='clk_standard-2584-y21', 'A5b: Demand', Subtype AS [Subtype New]

BookKK.JPG

1 Solution

Accepted Solutions
micheledenardi
Specialist II
Specialist II

You can create a key with the concatenation of key field  then use ApplyMap() function to get [Type New], then use the preceding load re-use your mapping table to get [SubType New] based on [Type New] values, so:

Map1:
Mapping
Load Key, Value Inline [
Key, Value
A2|DDD002|Brand|clk_standard-2584-y21,A-High
A-High,A5b: Demand
];


BookKK:
Load *,
   ApplyMap('Map1',[Type New],Null()) as [Subtype New];
Load
   ...
   ...
   ApplyMap('Map1',Type&'|'&Subtype&'|'&Category&'|'&Code,Null()) as [Type New]
From ...;
Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

1 Reply
micheledenardi
Specialist II
Specialist II

You can create a key with the concatenation of key field  then use ApplyMap() function to get [Type New], then use the preceding load re-use your mapping table to get [SubType New] based on [Type New] values, so:

Map1:
Mapping
Load Key, Value Inline [
Key, Value
A2|DDD002|Brand|clk_standard-2584-y21,A-High
A-High,A5b: Demand
];


BookKK:
Load *,
   ApplyMap('Map1',[Type New],Null()) as [Subtype New];
Load
   ...
   ...
   ApplyMap('Map1',Type&'|'&Subtype&'|'&Category&'|'&Code,Null()) as [Type New]
From ...;
Michele De Nardi
If a post helps to resolve your issue, please accept it as a Solution.