If possible refernce matrix cell in report builder 6i [message #434987] |
Sun, 13 December 2009 00:47 |
|
Am using matrix report in 6i report builder,
In that i needs to reference a matrix cell values.
certainly my columns are dynamic ,for ex if i have given
date as 03072009(ddmmyyyy) i have to get the columns like
jan08 jan09 feb08 feb09 mar08 mar09 apr08 apr09 may08 may09 jun08 jun09 jul08 jul09
the above shown are headings for the columns.
i have got the figures correct with use of the following query.
What i trying to do is i can combinly use a formula column and conditional formatting if i reference a matrix cell field value that is sales08 sales09
SELECT decode(pc.refcode,'K','IC','M','IC',pc.refcode) code,
TO_CHAR (fgd.docdt, 'MON') MONTH,
sum(CASE
WHEN fgd.tc = 2 and TO_CHAR (fgd.docdt, 'YY') = '08'
THEN fgd.amount1 + fgd.amount2 + fgd.amount3
WHEN fgd.tc = 3 and TO_CHAR (fgd.docdt, 'YY') = '08'
THEN fgd.amount1 + fgd.amount2 + fgd.amount3
WHEN fgd.tc = 4 and TO_CHAR (fgd.docdt, 'YY') = '08'
THEN -fgd.amount1 - fgd.amount2 - fgd.amount3
ELSE 0
END
) sales08,
sum(CASE
WHEN fgd.tc = 2 and TO_CHAR (fgd.docdt, 'YY') = '09'
THEN fgd.amount1 + fgd.amount2 + fgd.amount3
WHEN fgd.tc = 3 and TO_CHAR (fgd.docdt, 'YY') = '09'
THEN fgd.amount1 + fgd.amount2 + fgd.amount3
WHEN fgd.tc = 4 and TO_CHAR (fgd.docdt, 'YY') = '09'
THEN -fgd.amount1 - fgd.amount2 - fgd.amount3
ELSE 0
END
) sales09
FROM fg_detail fgd INNER JOIN sdepot d ON d.depot =fgd.depot
INNER JOIN prodfle p ON p.prodcd = fgd.prodcd
INNER JOIN prodref_classification pc
ON p.class_code = pc.class_code
INNER JOIN prodref pr ON pc.refcode = pr.refcode
WHERE
((fgd.docdt between '01-jan-'||to_char(add_months(:pdate,-12),'rrrr')
and LAST_DAY (ADD_MONTHS (:pdate, -12)) )
or
(fgd.docdt between '01-jan-'||to_char(:pdate,'rrrr') and
LAST_DAY (:pdate)))
--AND d.rgncode = 30
and fgd.depot = 43
AND ( pc.refcode = 'K'
OR pc.refcode = 'M'
OR pc.refcode = 'D'
OR pc.refcode = 'Q'
OR pc.refcode = 'B'
)
GROUP BY decode(pc.refcode,'K','IC','M','IC',pc.refcode),
TO_CHAR (fgd.docdt, 'MON')
|
|
|
|
|