Skip to main content
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

1 Solution

Accepted Solutions
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

View solution in original post

16 Replies
Not applicable
Author

Hi,

it should work.

This script loads 4 rows for me...Try it:

data_tbl:

LOAD * INLINE [

    month, val

    1, 1

  

];

Concatenate (data_tbl)

first 3

LOAD * INLINE [

    month, val

    16, 1

    20, 3

    23, 2

    24, 4

 

];

tresesco
MVP
MVP

I tried this:

Input:

Load * Inline [

Name

swuehl

Gysbert

Miguel

Jagan

Michael

];

Concatenate

OutPut:

first 2 Load * Inline [

Name

John

manish

Henric

Rob

];

And it worked fine.

Screen Shot 06-04-14 at 01.36 PM.PNG.png

its_anandrjs

No i believe when you load first 2 records from table 1 but after concatenate all data from the table two concatenate to the table 1, First 2 works for table 1 only and loads only first 2 records.

Eg:-

First 2

test:

LOAD * Inline

[

id,name,class,num

1,a,I,23

2,df,II,34

3,dfs,I,25

4,s,II,25

5,fs,II,67

];

Concatenate(test)

LOAD * Inline

[

id,name,class,num

7,sfs,I,2544

8,fsaafs,II,67555

1,da,I,452

2,das,I,34

4,faf,II,545

];

ashfaq_haseeb
Champion III
Champion III

Hi

It just work fine.

try the below code you will get only 4 rows.

Test:

First 2

load * Inline

[DATE_ID, STORE_ID, POS_NUMBER, TICKET_NUMBER, BARCODE_13, AMOUNT

28/5/2014, 21, 14, 201, 1234567890123, 100

28/5/2014, 21, 14, 301, 2345678901234, 200

28/5/2014, 136, 12, 101, 3456789012345, 150

28/5/2014, 136, 12, 401, 4567890123456, 300

28/5/2014, 101, 10, 501, 1234567890123, 200

28/5/2014, 101, 13, 201, 6789012345678, 150];

Concatenate

First 2

load * Inline

[DATE_ID, STORE_ID, POS_NUMBER, TICKET_NUMBER, BARCODE_13

28/5/2014, 21, 14, 201, 1234567890123

28/5/2014, 21, 14, 301, 2345678901234

28/5/2014, 136, 12, 101, 3456789012345

28/5/2014, 136, 12, 401, 4567890123456

28/5/2014, 103, 15, 501, 9012345678901

28/5/2014, 101, 16, 101, 3456789012345];

Regards

ASHFAQ

Anonymous
Not applicable
Author

Hi Dariusz,

Thanks for trying it but if I create qvd of both the tables separately by adding one more field to the second table ,In that case 'First n' will not work .

I tried the following script :-

LOAD

       month,

        val

FROM

            (qvd);

Concatenate (data_tbl)

first 3

LOAD

      month,

      val

    //, data

FROM

            (qvd);

Thanks

Not applicable
Author

Strange

this works for me....

LOAD month,

     val,

     m

FROM

(qvd);

Concatenate

First 2

LOAD month+1 as month,

     val+3 as val

FROM

(qvd);

what does it mean: "does not work"? there are more rows loaded or maybe no rows from 2'nd table? or maybe you have some error??

Anonymous
Not applicable
Author

Hi,


"Does not work " means all rows of second table are concatenated with the first table .

Not applicable
Author

if you delete or comment concatenate statement and load 2'nd table changing field names using as, what do you have loaded into it?

Anonymous
Not applicable
Author

Hi Dariusz,

Please find the attachment.

It would be more clear what I am trying to say.

Thanks