Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
ramshoney
Contributor

add 1 or 2 columns into the load commands

Hi, do we have the option to load the column data from one table to another table?

Section01:

[POSTAL DATA]:

LIB CONNECT TO HIVEODBC;

LOAD ID,

Postcode,

Postdesc,

Sate,

StateDesc;

SQL SELECT ID,

Postcode,

Postdesc,

Sate,

StateDesc

FROM HIVE.POSTTAB;

Section2:

[KMLFile]:

LOAD ID,

SADIGIT,

LONG,

LAT

FROM [lib://kmlfile/kmlfile.csv]

(txt, utf8, embedded labels, delimiter is ',', msq);

( Now as per the above, the two tables gets Join with ID) Here, I want to load the Postcode, Postdesc into the section2 (KMLFile] Table as well, how to achieve it.

Output should be:

[POSTAL DATA] : (ID,Postcode,Postdesc,State,StateDesc) Colums

[KMLFile]: (ID,SADIGIT,LONG,LAT,Postcode,Postdesc), ( 2 (Postcode,Postdesc) columns from [POSTAL DATA] should add to this [KMLFile] Table).

Rams.

8 Replies
Khan_Mohammed
Honored Contributor II

Re: add 1 or 2 columns into the load commands

Maybe below?

[POSTAL DATA]:

LIB CONNECT TO HIVEODBC;

LOAD ID,

Postcode,

Postdesc,

Sate,

StateDesc;

SQL SELECT ID,

Postcode,

Postdesc,

Sate,

StateDesc

FROM HIVE.POSTTAB;

[KMLFile]:

LOAD ID,

SADIGIT,

LONG,

LAT

FROM [lib://kmlfile/kmlfile.csv]

(txt, utf8, embedded labels, delimiter is ',', msq);

Left join ([KMLFile])

Load

LOAD ID,

Postcode,

Postdesc

Resident [POSTAL DATA];


Depending on your Data inside you can do join... to learn more check the below link

Different Join Functions in Qlikview


ramshoney
Contributor

Re: add 1 or 2 columns into the load commands

Aehman, Thanks for the response.

I Think Left Join([POSTAL DATA]) right?

as below

[POSTAL DATA]:

LIB CONNECT TO HIVEODBC;

LOAD ID,

Postcode,

Postdesc,

Sate,

StateDesc;

SQL SELECT ID,

Postcode,

Postdesc,

Sate,

StateDesc

FROM HIVE.POSTTAB;

[KMLFile]:

LOAD ID,

SADIGIT,

LONG,

LAT

FROM [lib://kmlfile/kmlfile.csv]

(txt, utf8, embedded labels, delimiter is ',', msq);

Left join ([POSTAL DATA])

Load

LOAD ID,

Postcode,

Postdesc

Resident [POSTAL DATA];



//Correct me if I'm wrong.

Khan_Mohammed
Honored Contributor II

Re: add 1 or 2 columns into the load commands

Left join ([KMLFile]) is correct.

Cus you are joining the below table to KML Table not Postal Table.

after join check if the Data is showing correct. If not check the link I gave and do the appropriate join.

aronwilliamson
Contributor

Re: add 1 or 2 columns into the load commands

You could try a mapping load.

Map_Postcode:

Mapping LOAD ID,

                          Postcode

FROM HIVE.POSTTAB;

Map_Postdesc:

Mapping LOAD ID,

                          Postdesc

FROM HIVE.POSTTAB;

Section2:

[KMLFile]:

LOAD ID,

SADIGIT,

LONG,

LAT,

Applymap('Map_Postcode',ID,0) as Postcode,

Applymap('Map_Postdesc',ID,0) as Postdesc,

FROM [lib://kmlfile/kmlfile.csv]

(txt, utf8, embedded labels, delimiter is ',', msq);

mark6505
Valued Contributor III

Re: add 1 or 2 columns into the load commands

Hi there.

I would follow the instructions supplied by Aehman K. The join should work, but you would have to alias a the fields you are joining or it will give you problems with your data model.

[POSTAL DATA]:

LIB CONNECT TO HIVEODBC;

LOAD ID,

Postcode,

Postdesc,

Sate,

StateDesc;

SQL SELECT ID,

Postcode,

Postdesc,

Sate,

StateDesc

FROM HIVE.POSTTAB;

    

[KMLFile]:

LOAD ID,

SADIGIT,

LONG,

LAT

FROM [lib://kmlfile/kmlfile.csv]

(txt, utf8, embedded labels, delimiter is ',', msq);

    

Left join ([KMLFile])

    

Load

LOAD ID,

Postcode            AS KML_Postcode,

Postdesc             AS KML_Postdesc

Resident [POSTAL DATA];

Mark

ramshoney
Contributor

Re: add 1 or 2 columns into the load commands

Ya its working by giving alias.

Thanks.

ramshoney
Contributor

Re: add 1 or 2 columns into the load commands

Aron,Thanks for the reply.

I will try this.

Khan_Mohammed
Honored Contributor II

Re: add 1 or 2 columns into the load commands

Yes, I forgot about changing the name.

Community Browser