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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Nagaraju_KCS
Specialist III
Specialist III

Map field to other table

Hi Community,

I want to map field one table to another table.

please look at here..

Suppose i have 2 tables..

Table1:

CostCentreAccountClientCodeAmountYear
511017011036600112452014
1915110311ABCD10002014
1915110711ABCD122014
1915110311ABCD1232014
1915110311ABCD452014
1915110311ABCD802014
1915110711ABCD302014

Table2:

CostCentreClientCodeTypeAmountyear
5110366001WIP IN12452014
1915ABCDWIP OUT10002014
1915ABCDNotes122014
1915ABCDABC1232014
1915ABCDSUMAC02014
1915ABCDWIP IN892014

1915

ABCD

WIP OUT

9

2014

1916ABVFABVH192014

These are my 2 tables, Table1 is main data, Table2 is also almost same,

but Amount different.

Here i have to map Type field to Table1, i don't bother about Amount in second table.

I want to Table1 Amount  only.

Note: Only i have to Map Type field to Table1.

My Output should be, If i am take

Dimension: Type

Expression: Sum({<Year={'2014'}>}Amount)

 

Type2014
WIP IN1325
WIP OUT1030
Notes12
ABC123
SUMAC45

Hope you Understand....

Thanks in Advance..

14 Replies
avinashelite

Try like this

Type_Mapping:

Mapping LOAD

CostCentre&'-'&ClientCode&'-'&Year as Key,

Type

from table2;

Table1:

LOAD

CostCentre,

Account,

ClientCode,

Amount,

Year,

applymap('Type_Mapping',CostCentre&'-'&ClientCode&'-'&Year,'NA') as Type

from

table1;

Nagaraju_KCS
Specialist III
Specialist III
Author

this is correct, but if i have any shuffle data..

it will wrong.

avinashelite

Did you tried my suggestion

Not applicable

Hi,

May be like this,

Create a key With combination of rec no in both tables, then do applemap,

tt:

Mapping LOAD

//CostCentre,

CostCentre&ClientCode&year&RecNo() as key,

Type

Resident Table2;

DROP Table Table2;

map:

LOAD *,

RecNo(),

ApplyMap('tt',CostCentre&ClientCode&Year&RecNo(),'') as type

Resident Table1;

DROP Table Table1;

You can use order by in both table if you have suffle data.

May be this will work try it

jonathandienst
Partner - Champion III
Partner - Champion III

qv_testing wrote:

in my second table Amount someone entered manually,

So values are not correct.

Only i need to fetch Table1 Amount Only.

i want to compare with Costcentre, CLientCode and Year.

I have to Map Type field to Table1.

You don't have enough information to do what you ask. Costcentre, ClientCode and Year do not identify individual rows in either table, so you cannot associate a single Type with each row in Table1. And you will not be able to produce your output table without some additional information.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein