Hi All,
We are facing a Fan Trap problem. We are having 3 tables which are refered in the report. The relation between these tables is as:
CRT_CURRENCY ----< PRC_RATE-----< CAPACITY_DTL.
The data in these tables is as:
Table CRT_CURRENCY:
CCY_CD LNG_DESC
--------------------------
GBP Pound
USD US Dollar
Table PRC_RATE:
RATE_LINE_ID VER_NO CCY_CD TOT_PROMSD_REV
--------------------------------------------------------------
12345 1 GBP 1000
12345 2 GBP 900
66666 1 GBP 750
66666 2 GBP 800
Table CAPACITY_DTL:
RATE_LINE_ID VER_NO ITEM_TYP_CD
--------------------------------------------
12345 1 I-1
12345 1 I-2
12345 2 I-3
66666 1 I-4
66666 2 I-5
In the report we are having Dimensions from Table CRT_CURRENCY, PRC_RATE and CAPACITY_DTL and Measures from table PRC_RATE.
The output we are getting in the report is as:
CCY_CD LNG_DESC ITEM_TYP_CD TOT_PROMSD_REV
---------------------------------------------------------------
GBP Pound I-1 1000
GBP Pound I-2 1000
GBP Pound I-3 900
GBP Pound I-4 750
GBP Pound I-5 800
Total 4450
As it can be seen above the value 1000 for TOT_PROMSD_REV is repeated twice because of fan trap problem. We have created Alias of table PRC_RATE & used the formula @Aggregate_Aware(SUM(PRC_RATE.TOT_PROMSD_REV),SUM(PRC_RATE1.TOT_PROMSD_REV) in the object for TOT_PROMSD_REV.
We are not sure whether the report output above is corect or not i.e value 1000 appearing twice for TOT_PROMSD_REV. Also if ITEM_TYP_CD is deleted from the report (not the query) the total still appears as 4450 which is incorrect. Please suggest solution/comments to the above problem??
The query which the report has generated after using aggregate awareness is as below:
SELECT
CRT_CURRENCY.CCY_CD,
CRT_CURRENCY.LNG_DESC,
CAPACITY_DTL.ITEM_TYP_CD,
SUM(PRC_RATE1.TOT_PROMSD_REV)
FROM
CRT_CURRENCY,
PRC_RATE PRC_RATE1,
CAPACITY_DTL,
PRC_RATE
WHERE
PRC_RATE.CCY_CD=CRT_CURRENCY.CCY_CD(+)
AND CAPACITY_DTL.RATE_LINE_ID(+)= PRC_RATE.RATE_LINE_ID and CAPACITY_DTL.VER_NO(+)=PRC_RATE.VER_NO
AND PRC_RATE.RATE_LINE_ID=PRC_RATE1.RATE_LINE_ID and PRC_RATE.VER_NO=PRC_RATE1.VER_NO
AND CRT_CURRENCY.CCY_CD = 'GBP'
GROUP BY
CRT_CURRENCY.CCY_CD,
CRT_CURRENCY.SHORT_DESC,
CRT_CURRENCY.LNG_DESC,
CAPACITY_DTL.ITEM_TYP_CD
Thanks.
[Edited, when posting code samples please use the code option for formatting. It will preserve any indenting or formatting that you may have done. You might have to edit your post further to align the columns properly. Thank you, Andreas.]
diganta_goswami (BOB member since 2006-12-14)