Sunday, February 28, 2016

How To Incorporate New Line In Column Text In OBIEE?

Sometimes you want to wrap the column text at some specific point or position. For that you need to understand following two concepts:-
i) Word wrap takes place when a "Line Feed('/n')" character is used. The ASCII of Line Feed is 10 in decimal. In OBIEE, char() functions returns an equivalent character for an ASCII value. So, if we use char(10) then a Line Feed is expected.

ii) In HTML, "PRE" tag is used to preserve Spaces And Line Feed.

Combining the above two concepts we can introduce a New Line in Column Text. e.g:- A column "Name" contains both the "First Name" And the "Last Name".

Click image for larger version. 

Name: Image1.JPG 
Views: 1620 
Size: 5.7 KB 
ID: 1248

Now, we want to display it like the following:-

Click image for larger version. 

Name: Image2.JPG 
Views: 1630 
Size: 7.0 KB 
ID: 1249

For this, edit your column formula like the following:-


Code:
REPLACE(<YOUR COLUMN>, ' ',char(10))
The above formula will replace the spaces with New Line character.

Now, Override Default Data Format and use Custom Text Format Like the Following:-

Click image for larger version. 

Name: Image3.JPG 
Views: 1697 
Size: 20.7 KB 
ID: 1250

The custom Text Format is:-
Code:
  @[HTML]"<pre>"@"</pre>"

2 comments:

  1. this helped me a great deal, but for my solution I ended up coding like this in the formula field:
    REPLACE(, ' ','
    ') and used Html format for data format

    ReplyDelete
  2. this helped me a great deal, but for my solution I ended up coding like this in the formula field:
    REPLACE(, ' ','
    ') and used Html format for data format

    ReplyDelete