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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jessica_webb
Creator III
Creator III

ApplyMap after crosstable

Hello,

I have a problem which I feel should be straightforward to solve. But I can't do it...

Basically, I have a table called Data.

I then load a temp table as a crosstable, called 'tempData'.

I then left join my tables:

LEFT JOIN (Data) LOAD * Resident tempData;

Drop TABLE tempData;

Now, I want to applymap to one of the fields that was in tempData, but is now in Data.

How do I do this?

Many thanks,
Jess

Labels (1)
1 Solution

Accepted Solutions
stabben23
Partner - Master
Partner - Master

Hi Jessica,

you can load the Data table once agin With a resident LOAD.

Data2:

LOAD

*,

applymap('map',field) as fieldNew

Resident Data;

drop table Data;

View solution in original post

13 Replies
stabben23
Partner - Master
Partner - Master

Hi,

maybe you could try to do a mapping Load before you drop the tempData.

LEFT JOIN (Data) LOAD * Resident tempData;

Mapping LOAD

map:

field1 as Mapkey,

field2 as mapfield

resident tempData;

Drop TABLE tempData;

swuehl
Champion III
Champion III

Before you can use ApplyMap() function, you need to load a MAPPING table:

Mapping … and not the geographical kind

You can then use your mapping table using an ApplyMap() e.g. in the RESIDENT LOAD of your tempData table.

jessica_webb
Creator III
Creator III
Author

Hi Stefan,

I should have explained that I have already loaded the mapping table.

How would I applymap in the resident load? That's the bit I'm stuck on!

Thanks,

Jess

neha_shirsath
Specialist
Specialist

Hi Jessica,

Can you put some sample data for brief idea of your issue.

Thanks & Regards,

Neha

stabben23
Partner - Master
Partner - Master

Hi Jessica,

you can load the Data table once agin With a resident LOAD.

Data2:

LOAD

*,

applymap('map',field) as fieldNew

Resident Data;

drop table Data;

jessica_webb
Creator III
Creator III
Author

Hi Neha,

Of course!

Map_New:

Mapping LOAD * INLINE [

Given,New

A,1

B,2

];

Data:

LOAD

ID,

Type

FROM xxxxxxxx

tempData:

CrossTable(Given,Outcome,1)

LOAD

ID,

A,

B

FROM xxxxx

JOIN (Data) LOAD* Resident tempData;

Drop TABLE tempData;

At this point, I want to applymap with 'Map_New', so that in my  'Data' table, I am left with ID, Type, New, Outcome

and can drop 'Given'.

sunny_talwar
MVP
MVP

May be use ApplyMap when you are joining?

Map_New:

Mapping LOAD * INLINE [

Given,New

A,1

B,2

];

Data:

LOAD

ID,

Type

FROM xxxxxxxx

tempData:

CrossTable(Given,Outcome,1)

LOAD

ID,

A,

B

FROM xxxxx

JOIN (Data)

LOAD *,

          ApplyMap('Map_New', FieldName, Null()) as NewFieldName

Resident tempData;

DROP Table tempData;

stabben23
Partner - Master
Partner - Master

That is a better solution than mine.

sunny_talwar
MVP
MVP

I guess the only good thing here is that we have one less load