Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI
I have following table with below data
tableA:
Product | Stock Dead Level | From Date | Todate | Status |
---|---|---|---|---|
A | 20 | 1 jan 2012 | 30 jun 2012 | Green |
B | 30 | 1 mar 2012 | 31 dec 2012 | Yellow |
... | ..... | ..... | ..... | .... |
and i am looking for QV script which convert this table into following table
tableB:
Date | Product | Stock Dead Level | Status |
---|---|---|---|
1 jan 2012 | A | 20 | Green |
2 jan 2012 | A | 20 | Green |
..... | ... | .... | .... |
...... | ..... | .... | ..... |
30 jun | A | 20 | Green |
1 mar 2012 | B | 30 | Yellow |
2 mar 2012 | B | 30 | Yellow |
... | .... | ..... | ...... |
31 dec 2012 | B | ...... | Yellow |
regards
T1:
LOAD Product, [Stock Dead Level],
date#([From Date],'D MMM YYYY') as [From Date],
date#([Todate],'D MMM YYYY') as [Todate],
Status INLINE [
Product, Stock Dead Level, From Date, Todate, Status
A, 20, 1 jan 2012, 30 jun 2012, Green
B, 30, 1 mar 2012, 31 dec 2012, Yellow
];
T2:
load *, date([From Date]+IterNo()-1,'D MMM YYYY') as Date
Resident T1 While [From Date]+IterNo()-1<=Todate;
drop table T1;
See attached qvw
T1:
LOAD Product, [Stock Dead Level],
date#([From Date],'D MMM YYYY') as [From Date],
date#([Todate],'D MMM YYYY') as [Todate],
Status INLINE [
Product, Stock Dead Level, From Date, Todate, Status
A, 20, 1 jan 2012, 30 jun 2012, Green
B, 30, 1 mar 2012, 31 dec 2012, Yellow
];
T2:
load *, date([From Date]+IterNo()-1,'D MMM YYYY') as Date
Resident T1 While [From Date]+IterNo()-1<=Todate;
drop table T1;
See attached qvw