Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Applymap in case of 3 columns?

Dear Friends,

I want to applymap in case of 3 columns where values in 1st two columns are repeating.

e.g.

Column1    Column2    Column3

A                x                1

A                y                2

C                x                3

C                y                4

E                z                5

I could have loaded this table as it is. But 1st two columns are there in some other tables also and they are linked with specific logic.

Adding this table is creating multiple loops.

Hoping for earliest help.

Best Regards,

Happy Thoughts

5 Replies
vijay_iitkgp
Partner - Specialist
Partner - Specialist

Hi ,

You can do this by Creating 1 field by concatenating Column1 and Column2 and apply map .

Mapping Load

Column1&Column2 As Column,

Column3

...

SunilChauhan
Champion II
Champion II

use likee below

tab1:

Load * inline [

Column1    Column2    Column3

A                x                1

A                y                2

C                x                3

C                y                4

E                z                5

];

Mapping

Map1:

Load

column 1,

column3

resident tab1;

Mapping

Map2:

Load

column 1,

column3

resident tab1;

drop table tab1;

add using two apply map to other table

hope this help

Sunil Chauhan
Not applicable
Author

Hi,

Thanks, but it is not helping me.

Can you elaborate what you said in last line - "add using two apply map to other table"?

Thanks

SunilChauhan
Champion II
Champion II

Mapping

Map1:

Load

column 1,

column3

resident tab1;

Mapping

Map2:

Load

column 1,

column2

resident tab1;

drop table tab1;

applymaap('Map1',column1) as Column3 

applymaap('Map2',column1) as Column2

Sunil Chauhan
ysj
Creator
Creator

//Applymap in case of 3 columns?.


TestMap:

Mapping

LOAD

Column3,

Column1 &'-' &Column2 as NewColumn

//Column3

INLINE [

    Column1, Column2, Column3

    A, x, 1

    A, y, 2

    C, x, 3

    C, y, 4

    E, z, 5

];


New:


LOAD

City ,

ID,

ApplyMap('TestMap',ID,'Unknown') as CombinedCols,

Subfield(ApplyMap('TestMap',ID,'Unknown'),'-',1) as 1,

Subfield(ApplyMap('TestMap',ID,'Unknown'),'-',2) as 2

INLINE [

    City, ID

    NewYork, 1

    NeewJerssy, 2

    Cal, 3

    Alaska, 4

    Nagpur, 5

];