Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
New Contributor II

Fill table with datas while the first date less than the second date

Hi Experts,

I got stuck in development, please help me a little bit. 😊

I have a table, which contains rows of inter-warehouse transfer. I would like to fill the table with other days, when the products are in the truck.

The table:

ProductQuantityVoucherDateFulfillmentDate
1102019-10-042019-10-06
2202019-10-042019-10-09
352019-08-092019-08-14
482019-08-092019-08-12

 

What I want to see:

ProductQuantityVoucherDateFulfillmentDate
1102019-10-042019-10-06
1102019-10-052019-10-06
2202019-10-042019-10-09
2202019-10-052019-10-09
2202019-10-062019-10-09
2202019-10-072019-10-09
2202019-10-082019-10-09
352019-08-092019-08-14
352019-08-102019-08-14
352019-08-112019-08-14
352019-08-122019-08-14
352019-08-132019-08-14
482019-08-092019-08-12
482019-08-102019-08-12
482019-08-112019-08-12

 

Thanks for reply!

Labels (1)
1 Solution

Accepted Solutions
Highlighted
Valued Contributor II

Re: Fill table with datas while the first date less than the second date

Please check the attached

View solution in original post

4 Replies
Highlighted
Partner
Partner

Re: Fill table with datas while the first date less than the second date

Hi,

try in this way

INPUT:
LOAD * Inline [
Product,Quantity,VoucherDate,FulfillmentDate
1,10,2019-10-04,2019-10-06
2,20,2019-10-04,2019-10-09
3,5,2019-08-09,2019-08-14
4,8,2019-08-09,2019-08-12
]
;

NoConcatenate
OUTPUT:
LOAD
' ' AS TEMP
AutoGenerate 0;


FOR i=0 to NoOfRows('INPUT')-1

LET Product = Peek('Product',$(i),'INPUT');
LET Quantity = Peek('Quantity','$(i)','INPUT');
LET VoucherDate = Peek('VoucherDate','$(i)','INPUT');
LET FulfillmentDate = Peek('FulfillmentDate','$(i)','INPUT');

Concatenate
LOAD
'$(Product)' as Product,
'$(Quantity)' as Quantity,
Date(('$(VoucherDate)'+IterNo()-1)) as VoucherDate,
Date('$(FulfillmentDate)') as FulfillmentDate
AutoGenerate 1 While ('$(VoucherDate)'+IterNo()-1) < '$(FulfillmentDate)'
;

NEXT

DROP Table INPUT;

DROP Field TEMP;

Highlighted
New Contributor II

Re: Fill table with datas while the first date less than the second date

Dear StarinieriG,

Thanks for your replay, it works perfectly, but I search the solution without loop. Unfortunately the loop is very slow with big table.😕

Highlighted
Valued Contributor II

Re: Fill table with datas while the first date less than the second date

Please check the attached

View solution in original post

Highlighted
New Contributor II

Re: Fill table with datas while the first date less than the second date

Dear anushree1,

It's perfect! Thank You so much, this is what I was looking for.👍