Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Column's data breaking
SPRAND
Hi,
I am facing a problem with a BIRT report.
Is there any way in BIRT to break the column(no space in it) into different pieces based on a condition.
For example:
I have a table, which has 10 columns in it. Widths of all the columns are same. I don't want to change width.
One of the columns in the table some times displays a String, which has more number of characters in it with
out any SPACE(Example: 122.123.124.125.126.127.128, no space at all). How can I move the large string into
next line if it does not have any space in it?
I can't use "<property name="whiteSpace">nowrap</property>", because the string doesn't have any space in it.
Can any one know how to solve this problem?
Thanks in advance..
--Sunil
Find more posts tagged with
Comments
RichT
Hi Sunil,<br />
<br />
You can use \n to add a new line. So determine the number of characters that can fit within the defined column width. In the expression builder of the Data element evaluate the length of the string. If the length is greater than column width then embed the new line into the string.<br />
<br />
Maybe something like this...<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>data = dataSetRow["CUSTOMERNAME"];
if (data.length>14)
data = data.substring(0,12) + "\n" + data.substring(12);
else
data
data;</pre>
<br />
If the string will require mulitple new lines then maybe you could run it thru a loop adding the new line every n number of characters.<br />
<br />
Hope that helps,<br />
Rich