Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Working of first and Concatenate

Hello All,

I have the  following script:

test:

First 2

LOAD id ,

     name,

     class ,

     num

FROM

(qvd);

Concatenate(test)

LOAD id ,

     name,

     class,

     num

FROM

(qvd);

In above script, function named  'First  n' ('n' being any integer value depending on the  records  available in the table,here 'n' is 2) works fine but if I use  the same function after concatenate ,it will not work.

Please help me whether it is possible  to use 'First n' after Concatenate or not.

Thanks

16 Replies
ashfaq_haseeb
Champion III
Champion III

Hi,

How many rows your do you have in you table 2.

Can you post your qvd too.

Regards

ASHFAQ

Anonymous
Not applicable
Author

Hi Ashfaq,

Thanks for the concern.

Please find the attachments of qvd.

Regards

Geeta

ashfaq_haseeb
Champion III
Champion III

Hi,

just try this code.

data_tbl:

LOAD month,

     val,

     1 as Flag

FROM

(qvd);

concatenate(data_tbl)

first 3

LOAD month,

     val,

     data,

      2 as Flag

FROM

(qvd);

Regards

ASHFAQ

Anonymous
Not applicable
Author

Hi Ashfaq,

It works fine .

Thanks a lot

Could you please tell me the use of Flag here?

Regards,

Geeta

ashfaq_haseeb
Champion III
Champion III

Hi geeta,

By using flags you can differentiate two table I flagged table 1 with 1 and table2 with flag 2.

Now if you select 1 in flag which means this data is coming from table1 and if you select 2 in flag this means data is coming from table2.

If it answered your question, then close the thread by selecting appropriate answer.

Regards

ASHFAQ

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi Geeta,

I understood your issue.

Seems like a bug when loading in QVD and concatenate it behaves weird.

It loads N+1 records on this combination. If you want to load 3 rows then use 2.

data_tbl:

LOAD month,

     val

FROM

[data_tbl.qvd]

(qvd);

Concatenate(data_tbl)

first 2

LOAD month,

     val,

     data

FROM

[d2.qvd]

(qvd);

or try in this way

data_tbl:

LOAD month,

     val

FROM

[data_tbl.qvd]

(qvd);

temp_data_tbl:

first 2

LOAD month,

     val,

     data

FROM

[d2.qvd]

(qvd);

Concatenate(data_tbl)

LOAD

  *

Resident temp_data_tbl;

DROP Table temp_data_tbl;

Anonymous
Not applicable
Author

Hi Celambarasan,


Thanks for the  information.


Regards,

Geeta