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)
separate text into severals columns
XFabien
Hello,
I want to present my report like the image below :
Find more posts tagged with
Comments
mwilliams
So, the text you want split is a very long text? Are there lots of rows with long text? Or is this just one long text that needs to split this way?
XFabien
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="94981" data-time="1328300934" data-date="03 February 2012 - 01:28 PM"><p>
So, the text you want split is a very long text? Are there lots of rows with long text? Or is this just one long text that needs to split this way?<br /></p></blockquote>
<br />
Hello Michael,<br />
<br />
In fact, the text is very long, just like the news in the newspaper. In this dateRow columnm there will be a lot of rows with the long text like this.<br />
<br />
So in your opinion, it's possible to do that or not? And between the texts, I will insert some tables.
mwilliams
It's possible, yes. Depending on how your data is set up, you'll have to use substrings or you'll have to make a scripted dataSet out of the data from your current dataSet, splitting the long texts up into rows that you can split over the columns.
XFabien
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="95004" data-time="1328334204" data-date="03 February 2012 - 10:43 PM"><p>
It's possible, yes. Depending on how your data is set up, you'll have to use substrings or you'll have to make a scripted dataSet out of the data from your current dataSet, splitting the long texts up into rows that you can split over the columns.<br /></p></blockquote>
<br />
<br />
Yeap, I thought about this solution too. But I am not good in javascript. If you don't mind to give me a little example with a long text is better. <br />
<br />
Thanks Michael.
mwilliams
What is your BIRT version?
XFabien
It's the lastest Actuate BIRT SP3.
mwilliams
Take a look at this example. The "Data Set" dataSet contains a single row of long text. In the fetch script, I split the long text into an array. I bind a text box to this dataSet at the top of my design, so that the dataSet runs. Then, in my scripted dataSet, "Data Set1", I take the array and step through it making short rows. I also create a field that numbers the rows to use in my filters on my tables. From there, it's a normal newspaper style report. A grid, some tables, and a filter on each table. Hope this helps.
XFabien
Hello Michael,
Thanks for your help.
In your example, you split the with a space but actually, in the newspaper, the words have not the same length. So which function should I use and do not separate the words?
mwilliams
Yeah. This was just a simple example used to show how to do it. Do your words not have spaces between them? With words of variable length, you'll just have to write a small script, in place of where I add 7 words each time, to check the length of each word before adding it, making sure it fits in your row, if not, return and start with that word on the next row. Let me know if this makes sense or not.
XFabien
Michael,
I tried to modify the script with the following :
if (currentRow < totalRows){
row["RowNum"] = rowNum;
temp = myArray[currentRow];
rowLength = myArray[currentRow].length;
i = 1;
do {
if (myArray[currentRow + i] != null){
if (rowLength < 70) {
temp = temp + " " + myArray[currentRow + i];
}
}
i++;
} while (rowLength < 70)
row["Shorter Text Rows"] = temp;
currentRow = currentRow + i;
rowNum++;
return (true);
}
return (false);
But it didn't work. Could you correct it and tell the problem, please?
And how to determine the paragraphs?
mwilliams
I modified the script in a way to make it work with variable length words. It can probably be cleaned up a bit, but I didn't take the time to do that.
Take a look. Let me know what you think.
XFabien
Sorry for the ****.
With the second example, we can not make the lines to be justified. Could you look for this?
mwilliams
It doesn't appear that you can justify a single line of text and since that's all we have because of what was needed to do this example this way. I guess you could modify the example to split the text into rows as long as what would fit in each column, but this could get a little trickier because of line spacing and line breaks depending on the length of words.
Shasha
<p>I see this is a long dead topic; But I have a similar requirement. </p>
<p>I am unable to run the example attached. </p>