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)
Remove trailing tabs when rendering Data item to text
Tsukasa
<p>Hello,</p>
<p> </p>
<p>I have a rptdesign that is rendered as a plain text output.</p>
<p>When renderen the result of a dataset (single value) in a data item the value will be followed by 6 tabulator characters. I have set all margins, paddings border-widths to 0pt width.</p>
<p> </p>
<p>Page layout:</p>
<p>...</p>
<p><Grid></p>
<p> <row></p>
<p> <cell></p>
<p> <Label><sampletag value="</Label></p>
<p> <Data> reference to a dataset column return one value, e.g. "dummy" </data></p>
<p> <Label>" /></Label></p>
<p> </cell></p>
<p> </row></p>
<p></Grid></p>
<p> </p>
<p>expected result:</p>
<ul><li><sampletag value="dummy" /></li>
</ul><p>birts rendered result:</p>
<ul><li><sampletag value="dummy\t\t\t\t\t\t" /></li>
</ul><p>when omitting the data element the values of the two labels get concatenated without any tabulator char in between.</p>
<p> </p>
Find more posts tagged with
Comments
micajblock
<p>Can you provide a sample design that we can run (using CSV or scripted data source) and version of BIRT you are using?</p>
Tsukasa
<p>just extracted the simplest sample to visualize the issue based on the demo data.
micajblock
<p>I do not see any extra tabs in the sample you sent.</p>
Tsukasa
<p>the "database" value is "<span>Atelier graphique" not "_<span>Atelier graphique_" (replaced whitespace with underscore to visualie) so there are even without looking into the html itself two whitespaces surrounding the data that should not be there.</span></span></p>
micajblock
<p>Those spaces are not in the HTML. Actually there is one after the quote in the second label, but that is there in the design as well. Once I delete it see attached HTML. No spaces. In any case my guess if you want tighter control maybe create one control that concatenates the static content with the data.</p>
Tsukasa
<p>Sorry for being picky but I highligthed the whitespaces I meant in the attached screenshot of your sample.
micajblock
<p>I like picky. :-) However, those white spaces are due to the span in the HTML. If you save the HTML there are no spaces. look at the HTML I uploaded. It is how HTML is displayed in the browser. BIRT has no control over that. The only other thing I can think of as I mentioned earlier is to create a single data item with all three parts.</p>
Tsukasa
<p>The problem with merging the three items into one is, that it only partially solves the issue, as the real use case conssist of four data elements separated by static text. These four are from different datasets (scripted datasource using RPC to get some data)</p>
<p> </p>
<p>My first attempt has been to use a joint dataset and render everything in one data element, but that failed due to the error mentioned above.</p>
micajblock
<p>Are the columns you are joining on the same data type.</p>
Tsukasa
<p>no, two are strings two are Java Objects</p>
micajblock
<p>Then turn the java objects in to strings.</p>
Tsukasa
<p>unfortunately datasets based on a scripted datasource do not allow computed columns in the report designers' dialog. So how to achieve your goal?</p>
micajblock
<p>modify the scripted dataset code.</p>
Tsukasa
<p>Changing the columns of the scripted dataset would break the RPC-API that is referenced by the java event handler. Is there a chance to create a dataset based on the other? I've been looking for this already but did not find a suitable answer at a first glance.</p>
micajblock
<p>Yes there is, but it is. Take a look at these 2:</p>
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/810-dynamic-content-from-library/'>http://developer.actuate.com/community/forum/index.php?/files/file/810-dynamic-content-from-library/</a></p>
;
<p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/files/file/993-simple-union-dataset/'>http://developer.actuate.com/community/forum/index.php?/files/file/993-simple-union-dataset/</a></p>
;
Tsukasa
<p>Thank you very much, after spending some time with your samples I happened to have another idea, which works for me.</p>
<p>Remember each dataset returns a single value only!</p>
<ul><li>dataset1: column1: String</li>
<li>dataset2: column1: String</li>
<li>dataset3: column1: JavaObject</li>
</ul><ol><li>locate datasets with colums of matching type and join them using a joint data set (here dataset1 and dataset2) -> jointDataSet1</li>
<li>add a computed column "joinkey" of type int with a static expression "1;" to jointDataSet1</li>
<li>for the dataset3 (using the java object column) create a joint data set that joins dataset3 with itself (results in matching types
) -> jointDataSet2</li>
<li>add a computed column "joinkey" of type int with a static expression "1;" to jointDataSet2</li>
<li>create a third joint dataset joining the other two (jointDataSet1, jointDataSet2) using the artifical column "joinkey" -> JointDataSet3</li>
<li>use JointDataSet3 in a data item to create the literal without the whitespaces.</li>
</ol><p>I highly discourage using this approach with datasets that return several hundred values, as memory consumption might explode. But for my single result value case this works like a charm.</p>
<p> </p>
<p>Thank you very much for your patience and valuable thoughts mblock. I very much appreciated your immediate help.</p>
<p> </p>
micajblock
<p>If it is only single values, you can store them in variables as the data is fetched and the use them in your report.</p>
Tsukasa
<p>As far as I know, using the javascript fetch event hook will surpress executing the java event handlers fetch method. That would prevent any data from being available</p>
Tsukasa
<p>Ok, I recognize that I'm not the fastest after 17 hours of work anymore. Thanks for putting me on the right track once again.</p>
<p> </p>
<ol><li>Dropped all the joint datasets added a data item with Display:"No Display" referencing the datasets to "join".</li>
<li>In onCreate added the value as a global variable to reportContext.</li>
<li>repeated the same for the other String dataset</li>
<li>use the dataset with the java object as return type for the data element in conjunction with the global variables</li>
<li>=> Nice clean solution</li>
</ol><p>Thank you once more</p>
micajblock
<p>Nice</p>