oraclereports - oracle matrix report filling null cells -
i have made matrix report in oracle report builder this

and here query report being calling
select a.p_date, l.sup_name, decode(a.perc_typ, 1, 'buff', 2, 'cow') perc_type, a.sup_rate rate, decode(a.perc_typ, 1, round(( nvl(a.fat_perc, 0) * nvl(a.gross_vol, 0) ) / 6, 5), 2, round( ( nvl(a.fat_perc, 0) + ( ( nvl(a.fat_perc, 0) * 0.22 ) + ( nvl(a.lr_perc, 0) * 0.25 ) + 0.72 ) ) * nvl(a.gross_vol, 0) / 13, 5)) vol mlk_purchase a, supplier l a.sup_cod = l.sup_cod , a.p_date <= trunc(sysdate) , a.p_date >= trunc(sysdate) - 7 order 1 problem there are showing empty cells no data coming query. want show 0 cells instead of empty space. there way in oracle report builder.
there @ least 2 solutions.
solution 1 -- in oracle reports, create boilerplate text object displays zero, , arrange object displays behind matrix field. way, boilerplate hidden when field displayed, revealed when field not displayed. solution described in documentation.
solution 2 -- rewrite query return rows 0 values combinations of row , column fields have no data. example, might find possible combinations of matrix row , column fields (supplier , date in case), outer join data combinations, , use nvl convert null values zeroes. might this:
select l.p_date, l.sup_name, decode(a.perc_typ, 1, 'buff', 2, 'cow') perc_type, a.sup_rate rate, nvl ( decode ( a.perc_typ, 1, round ( (nvl(a.fat_perc, 0) * nvl(a.gross_vol, 0)) / 6, 5 ), 2, round ( (nvl(a.fat_perc, 0) + ( (nvl(a.fat_perc, 0) * 0.22) + (nvl(a.lr_perc, 0) * 0.25) + 0.72) ) * nvl(a.gross_vol, 0) / 13, 5 ) ), 0 ) vol mlk_purchase a, ( select l1.sup_code, l1.sup_name, l2.p_date ( select distinct supplier.sup_code, supplier.sup_name supplier ) l1, ( select distinct mlk_purchase.p_date mlk_purchase mlk_purchase.p_date <= trunc(sysdate) , mlk_purchase.p_date >= trunc(sysdate) - 7 ) l2 ) l a.sup_cod (+) = l.sup_cod , a.p_date (+) = l.p_date order 1 a more efficient (and simpler) way rewrite query same effect might use partitioned outer join between mlk_purchase , supplier partitions sup_code, don't know extent version of oracle reports supports syntax.
Comments
Post a Comment