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: 
vmurugananthan
Contributor II
Contributor II

Apply Map

Hi,

I have a Qlikview script as below:

Load PrimaryIndicator,

SecondaryIndicator,

If(PrimaryIndicator = 'A' or

PrimaryIndicator = 'B' or

SecondaryIndicator = 'C' or 

SecondaryIndicator = 'D', 'Dep','NonDep') as DepressionIndicator

Resident Table1;

How do i convert the if condition into a Apply Map and Mapping load combination ?

I'm able to convert an if condition with single column into Apply Map and Mapping load combination but this scenario involved 2 columns (PrimaryIndicator, SecondaryIndicator) and i'm unable to do it with 2 column involved.

Looking forward for some suggestions. Thanks in Advance!

@vamsee @sunny_talwar @jagan 

 

Vignesh 

Labels (1)
1 Solution

Accepted Solutions
vamsee
Specialist
Specialist

May be

Map_Primary_Ind:
Mapping Load
Primary_Indicator,
'Dep' as Value
;
//Use your source table instead of below Inline
Load * Inline [
Primary_Indicator
A
B
]; 
Map_Secondary_Ind:
Mapping Load
Secondary_Indicator,
'Dep' as Value
;
Load * Inline [
Secondary_Indicator
C
D
];

In the table 

Applymap('Map_Primary_Ind',Primary_Indicator,Applymap('Map_Secondary_Ind',Secondary_Indicator,'Non Dep')) as DepressionIndicator

 

 

View solution in original post

3 Replies
fosuzuki
Partner - Specialist III
Partner - Specialist III

You can create a mapping table where the first column is the concatenation of Primary and Secondary, and the second column is the Indicator.

Then, in the load, you can use:

applymap('mapping table name', PrimaryIndicator & SecondaryIndicator) as DepressionIndicator

vamsee
Specialist
Specialist

May be

Map_Primary_Ind:
Mapping Load
Primary_Indicator,
'Dep' as Value
;
//Use your source table instead of below Inline
Load * Inline [
Primary_Indicator
A
B
]; 
Map_Secondary_Ind:
Mapping Load
Secondary_Indicator,
'Dep' as Value
;
Load * Inline [
Secondary_Indicator
C
D
];

In the table 

Applymap('Map_Primary_Ind',Primary_Indicator,Applymap('Map_Secondary_Ind',Secondary_Indicator,'Non Dep')) as DepressionIndicator

 

 

Brett_Bleess
Former Employee
Former Employee

You have two decent responses to your query, we would appreciate it if you would return to your thread and close it out by using the Accept as Solution button the post(s) that helped.  If you did something different, you can post what you did and then mark that post too, and if you still require assistance, please leave an update post for us.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.