Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
lmit
Creator II
Creator II

Duplicate records based on the input number

Hi All,

I have a requirement like below

col1;col2;col3

1;a;2

2;b;3

3;c;1

the records should be generated based on the col3 , if like col3 have 2 then the records should be 2 my output should like below

col1;col2;col3

1;a;1

1;a;2

2;b;1

2;b;2

2;b;3

3;c;1

any suggestions would be really appreciated

thanks,

lmit

Labels (2)
8 Replies
Anonymous
Not applicable

Hello,

You could use tLoop to output the same line several times base on the 'col3' field. The job looks like:

Input--tFlowToIterate--iterate-->tLoop--iterate-->tFixedFlowInput--main--tLogRow

 

on tLoop, set the To parameter as: (Integer)globalMap.get("row1.col3")

Please have a look at my screenshots for details.

0695b00000Z1ZTPAA3.png0695b00000Z1ZTKAA3.png0695b00000Z1ZTFAA3.png 

 

Best regards

Sabrina

lmit
Creator II
Creator II
Author

Hi @Xiaodi Shi​ ,

 

thanks for the suggestion and it worked but when am storing the data in file only the last record is getting saved

 

can you suggest what I can do ? Should I use the append option in the excel output

 

thanks,

lmit

lmit
Creator II
Creator II
Author

Hi All,

 

any suggestions would really appreciate

 

thanks in advance,

lmit

Anonymous
Not applicable

Hello,

Please check out "Append" option in the excel output component.

Note: Due to "Append" is written to cache, so if your inserted data is very huge, the job could get out Of memory exception.

Best regards

Sabrina

lmit
Creator II
Creator II
Author

Thanks @Xiaodi Shi​ 

 

yes append is giving out of memory error as I have huge data

 

any other alternative??

 

thanks,

lmit

Anonymous
Not applicable

Hello,

Is it getting loaded successfully when you try to append with less data using tfileoutputexcel component?

What the total number of records are you trying to load?

Best regards

Sabrina

 

lmit
Creator II
Creator II
Author

I have more than 1 lakh of records

 

no for less data (10 records)also am not getting @Xiaodi Shi​ 

 

thanks,

lmit

Anonymous
Not applicable

Hello

Could you please try to allocate more memory to the job execution to see if it helps?

Here is a KB article about: OutOfMemory Exception

Best regards

Sabrina