Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
TakacsZsolt
Contributor II
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
anushree1
Specialist II
Specialist II

Please check the attached

View solution in original post

4 Replies
StarinieriG
Partner - Specialist
Partner - Specialist

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;

TakacsZsolt
Contributor II
Contributor II
Author

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.😕

anushree1
Specialist II
Specialist II

Please check the attached

TakacsZsolt
Contributor II
Contributor II
Author

Dear anushree1,

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