Saturday, January 30, 2010

BI Publisher: How to format a specific column conditionally.






When I was going through a tech forum, this question got my attention.  
"How to format(bold, color,underline etc) specific column conditionally.

Say you have XML data, based on certain flag value, data should be displayed in a special format.
See the actual question here.

Here is the answer..
I created this test scenario at my end and it works for me.

Consider following data as my XML data file..
=====XML data begins. =====
1
abc
12,000.00
Y
2
def
13,000.00
N
3
ghi
14,000.00
N
=====XML data ends. =====

And the way I worked is as follows..

Following statement is the key in this solution
--

--
1. Create two IF conditions in your template.
- one Y 
- another one for N

2. Inside your IF under_line= Y region, use this font underline statement

3. Inside your IF under_line= N region, use simple amount display field. i.e

For your other requirements..
a. Underline must be of 13 characters length.. do PADding with spaces in your data source itself. So when it come to XML file, your amount column will comes with full 13 characters. 
ex: I did LPAD to my data. LPAD(amount,13,' ' )

b. For amount formats(ex: $12,345.60), try this in XML publisher template, else workout this also as a part of your XML data source(i.e Oracle Reports, or any..).    

Complete code can be downloaded here..  


In the same way you can do lot of other font formats like

etc..


Happy surfing.



4 comments:

oracleprahlad said...

it is a very informative blog.this is good blog to learn some thing.the data is also too good.

oraclefusion SCM said...

It is very Informative post. thanks for sharing such a post.
oracle fusion SCM on line training

oraclefusion HCM said...

it is very interesting topic thanks fir sharing such a wonderful topic.

oracle fusion HCM on line training



Unknown said...
This comment has been removed by a blog administrator.