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)
Data component in Table
KavithaD
Hi All,
I am having Table mapped to one data set and in the same table i want to have Data component which is mapped to different data set.Is it possible in Birt?
Please explain me how to configure
Thank you,
Kavitha
Find more posts tagged with
Comments
mwilliams
Hi Kavitha,
Does using a joint dataSet not work for you to get the other field into your report table? Or is it just a single value you want to grab from the other dataSet to bring to this table?
KavithaD
Hi mwilliams,
Thank you for the reply.Its a single value i want to display from another data set that should be displayed in table column.
Thank you,
Kavitha
mwilliams
Kavitha,
You should be able to grab the single value from the other dataSet and store it in a persistentGlobalVariable and recall that value in your other table in a dynamic text element.
KavithaD
Hi Michael,
I am having nested Tables like Table1,Table2,Table3.Inside Table1 i am having Table2 inside Table2 i am having Table3.
Table1
Table2
Table3.
From Table3 i am getting Serial number and comments.I want to display Serial numbers & Comments in a separate table.Please can you tel me how to grab the values from the Table3 dataSet and store it in as persistentGlobalVariable and recall that value in other table as a dynamic text element.
Thank you,
Kavitha.
mwilliams
Kavitha,
Can you explain more about where you're trying to display this value? Are you wanting a total out of table 3 displayed in the footer of table 2 or 1 or something? Let me know. Thanks.
KavithaD
Hi Michael,
Please find the attachment for my requirement.I could able to display Group,Sub Group and item level data in Table1, Table2 and Table3 respectively.In Table3 i will get Comments and Serial numbers.I need to store these values in some where and i have to display serial number and comments in another table as shown in attachment.For displaying Serial number i used your approach where you mentioned in other thread.Please help me out in doing this.
Thank you,
Kavitha
mwilliams
Kavitha,
So, you're wanting to grab multiple values from multiple "table 3"s. Your best bet might be to initialize an empty string in your initialize method, then as you create each line in your table 3, you can add what you want to the string variable from the line in the form of an html list or table, then you can use a text element with type html to display your list/table using <value-of format=html>variableName</value-of>.
Let me know if you have more questions.
KavithaD
Hi Michael,<br />
<br />
How to use string variable to store serial numbers and comments?Please could you provide me a sample report how to do it?<br />
<br />
I used Map and doing something like this,<br />
<br />
Report Design beforeFactory<br />
<br />
rtMap1 = new java.util.HashMap(); //For Table2<br />
rtMap2 = new java.util.HashMap(); //For Table3<br />
<br />
In detail row(Table2 & Table3 detail row)<br />
I added one dynamic Text and added function to write into hash map like<br />
<br />
For Table2 adding both serial numbers and comments to map<br />
<br />
temp = group1Count.toString();<br />
if(row["COMMENTS"] != null && row["ITEM_TYPE"] == 'I'){<br />
rtMap2.put(temp,row["COMMENTS"] );<br />
}<br />
temp<br />
<br />
For Table3 adding both serial numbers and comments to map<br />
<br />
temp=group1Count.toString() + detailRowID[detailCount];<br />
if(row["COMMENTS"] != null){<br />
rtMap1.put(temp, row["COMMENTS"] );<br />
}<br />
temp<br />
<br />
Table1 footer i am reinitializing hash maps like<br />
rtMap1 = new java.util.HashMap();<br />
rtMap2 = new java.util.HashMap();<br />
<br />
At the end of Table1 detail row In another table i am reading both the hash table like<br />
<br />
For Table2<br />
<br />
iterator = rtMap2.keySet().iterator();<br />
while (iterator.hasNext()) {<br />
key = iterator.next();<br />
temp = rtMap2.get(key) ;<br />
}<br />
<br />
For Table3<br />
<br />
iterator = rtMap1.keySet().iterator();<br />
while (iterator.hasNext()) {<br />
key = iterator.next();<br />
temp = rtMap1.get(key) ;<br />
}<br />
<br />
<br />
My problem is while reading i am getting single value, datas are getting override.Please let me know how to correct it.<br />
<strong class='bbc'>Please let me know Which is the best way using string or HashMap?</strong><br />
<br />
<br />
Thank you,<br />
Kavitha
mwilliams
Kavitha,
Here is a way to use an HTML list string to list the comments out. A hash map could probably also work fine, but a simple HTML list would do. All I do is initialize an empty variable in the initialize script of the report, then in the onCreate for the detail row of table3, I check if there are comments. If there are, I add a <ul></ul> tag to the string variable with the contents I want for that line inside. I then use a text element with HTML as the type and as the dynamic text format to display the created HTML list after the table is done. Let me know if you have questions or if this approach won't work for you.
This report was created in BIRT 2.5.1
KavithaD
Hi Michael,
Thank you very much for the sample.Its working fine.:)
1.I want to display comment in Table format Like serial number and Comments.how to display in Table format?
2.I want to display Table3 comments table for each Table1(mean to say Table1 details rows).how to reinitialize HTMLCommentsList.I have reinitialized HTMLCommentsList = "" in Table1 footer oncreate but it doesnot work for me.Please find the attachment and help me.
Thank you,
Kavitha
KavithaD
<blockquote class='ipsBlockquote' data-author="'KavithaD'" data-cid="66957" data-time="1280815227" data-date="02 August 2010 - 11:00 PM"><p>
Hi Michael,<br />
Thank you very much for the sample.Its working fine.:)<br />
<br />
1.I want to display comment in Table format Like serial number and Comments.how to display in Table format?<br />
2.I want to display Table3 comments table for each Table1(mean to say Table1 details rows).how to reinitialize HTMLCommentsList.I have reinitialized HTMLCommentsList = "" in Table1 footer oncreate but it doesnot work for me.Please find the attachment and help me.<br />
<br />
<br />
Thank you,<br />
Kavitha<br /></p></blockquote>
<br />
<br />
2.I reinitialize HTMLCommentsList in Table1 detail row oncreate.This Problem got resolved.<br />
<br />
I am unable to display HTMLCommentsList in table format please help me.
mwilliams
Kavitha,
What is the problem that you're having now?
KavithaD
Hi Michael,
I want to display Comments in a Table format like
SL No Comments
1a abc
1b efg
2a xyz
2b shgjhfdsjkshfdk
not like this
1a :abc
1b :efg
2a :xyz
2b :shgjhfdsjkshfdk
is there any way to display HTMLCommentsList in table format ?
Thank you,
Kavitha
mwilliams
Kavitha,
You could use the same idea and build an HTML table rather than a HTML list. You could also store these values in an array and build a dataSet from this array using a scripted dataSet.
KavithaD
Hi Michael,
I have done something like this,to create html table.
1.But table header is not bold.Is this is the correct way to do this?
if (row["COMMENTS"] != null){
temp=group1Count.toString() + detailRowID[detailCount];
if(HTMLCommentsTable.length>0){
HTMLCommentsTable = HTMLCommentsTable + "<table border= \"1\"><tr><td>"+temp+"</td>"+
"<td>"+row["COMMENTS"]+"</td></tr></table>";
}else{
HTMLCommentsTable = HTMLCommentsTable + "<table border= \"1\"><tr><th>Item No: (e.g. A2)</th><th>Comments</th></tr><tr><td>"+temp+"</td>"+
"<td>"+row["COMMENTS"]+"</td></tr></table>";
}
}
2.I am having one more problem i used nested tables(3 tables) but some times i am getting double line what could be the problem?
3.In BIRT Report Viewer html Table looks very bad but this is fine in PDF format.Please could you tel me how to correct the html table format.
Please help me i am in last stage of report completion
Thank you,
Kavitha
KavithaD
Hi Michael,
I want Item No. column width should be small and comments column length should be more.I tried with below code,Its not working for me
if (row["COMMENTS"] != null){
temp=group1Count.toString() + detailRowID[detailCount];
if(HTMLCommentsTable.length>0){
HTMLCommentsTable = HTMLCommentsTable + "<table border= \"1\" WIDTH=\"100%\"><tr><td WIDTH=\"10%\">"+temp+"</td>"+
"<td WIDTH=\"90%\">"+row["COMMENTS"]+"</td></tr></table>";
}else{
HTMLCommentsTable = HTMLCommentsTable + "<table border= \"1\"><tr><th>Item No: (e.g. A2)</th><th>Comments</th></tr><tr><td WIDTH=\"10%\">"+temp+"</td>"+
"<td WIDTH=\"90%\">"+row["COMMENTS"]+"</td></tr></table>";
}
}
I am working on HTML for the first time.Please help me.
Thank you,
Kavitha
mwilliams
Kavitha,
For the bold issue, I would guess you'd just need to use the html bold tags <B></B> around what you want to be bold. Setting the width inside the td tag should fix your width issue. What is it doing when you set the width like you do above?
KavithaD
Hi Michael,
If i use width or not Table remains the same.
Thank you,
Kavitha
mwilliams
Rather than \", try just using ' Maybe that'll make a difference. I'm not having the same issue with the way I'm doing it anyways. If you want to set up a report with this done how you've done it, I'll take a look.
KavithaD
Hi Michael,
I done as suggested but in pdf format column width is not getting changed.2 columns width are equally divided.Here i am attaching sample rptdesign.one more problem is some times in pdf report i am getting double lines in table.Please suggest me.(Comments table created through HTML is there at the end.)
I am having nested tables so checking for HTMLCommentsList is empty then creating header else just adding item number and comments.
if(HTMLCommentsList.length>0){
HTMLCommentsList = HTMLCommentsList + "<table border= '1' WIDTH='100%'><tr><td WIDTH='10%'>"+row["ORDERNUMBER"]+"</td>"+
"<td WIDTH='90%'>"+row["COMMENTS"]+"</td></tr></table>";
}else{
HTMLCommentsList = HTMLCommentsList + "<table border= '1'><tr><th>Item No: (e.g. A2)</th><th>Comments</th></tr><tr><td WIDTH='10%'>"+row["ORDERNUMBER"]+"</td>"+
"<td WIDTH='90%'>"+row["COMMENTS"]+"</td></tr></table>";
}
}
Thank you,
Kavitha
mwilliams
Kavitha,
Not sure what I was doing last week. I guess I wasn't running it in PDF. I've tried changing this around to get it to recognize the % widths, but it just doesn't. It makes it 50/50. It works in HTML, but not in PDF. I also tried this in version 2.6. Please log a bug for this at
http://www.birt-exchange.org/org/resources/bug-reporting/
. Thanks!
KavithaD
Hi Michael,
I have raised a bug for the same, Bug 322198.Do you have any idea about why double lines are coming in table when report is generated in PDF format.you can use the same sample rptdesign attached in previous thread.
Thank you,
Kavitha
mwilliams
Kavitha,
I changed your HTML as you were adding a new table for each "comment", so I don't see the double lines in mine. That is probably what did it. You only need to add the table tag in the else statement. The rest are just <tr> and <td> tags. Hope this helps.
KavithaD
Hi Michael,
I tried still i am getting double lines.Please Tell me what are those changes or else can you attach the changes rptdesign file.
Thank you,
Kavitha
mwilliams
Here ya go!
KavithaD
Hi Michael,
As you know i am having nested table.If there is comments in Table2 i am creating header of the table then looking for the Table3 comments and adding in html table format.if i remove <table> and give <tr> i am not getting table border for the comments table:(
Thank you,
Kavitha
mwilliams
Kavitha,
Can you set up an example that's more like yours with the sample database so that I can mess with the HTML to try to get it working for you?
KavithaD
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="67384" data-time="1281970475" data-date="16 August 2010 - 07:54 AM"><p>
Kavitha,<br />
<br />
Can you set up an example that's more like yours with the sample database so that I can mess with the HTML to try to get it working for you?<br /></p></blockquote>
<br />
Hi Michael,<br />
<br />
I am working on sample report as soon i complete i will get back to you.<br />
<br />
Thank you,<br />
Kavitha
mwilliams
I'll look forward to receiving it.