Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to get Column Information ?
vishal13
Hi,
I am new to birt report.
I want to display only requested column in report.
I will be getting list of interested columns.I am calling this java function on beforeFatch event of report want to compare this list with all present column in table and want to drop the column from master table which are not in request.
How to achieve this ??
I want all column information (binding column name) of table.(Name of dataset which we drag while peparing table.)
How to get this ??
Please help me...
Thanks in advance !
Find more posts tagged with
Comments
johnw
Select your column. In the property editor, go to the visibility tab. Change the visibility expression to true for whatever your condition is. So if you have a report parameter that is boolean for displaying that column, you would just use<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>(params["displayColumnA"] == false)</pre>
<br />
If this returns true (meaning the parmaeter is unchecked), it will hide that column. This expression could be anything though, it could be based on Java objects, environment variables, report parameters, data values. Do a search in the Forums, this question has been answered before.
vishal13
Hi,
Thanks for your reply.
But I am not using report parameter instead i will be getting Java list of intereseted column which i will be comapring with the list of all column present in a table and dropping the column not present in the list of intersted column.
So i want column binding names.i.e list of all column binding to that table.
So please tell me how to get this information ?
vishal13
<blockquote class='ipsBlockquote' data-author="'kenikeche'" data-cid="98699" data-time="1333950001" data-date="08 April 2012 - 10:40 PM"><p>
<strong><a href="<a class='bbc_url' href='
http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html'>http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html</a>
; ">Wedding Dresses 2012</a></strong><br><br />
<strong><a href="<a class='bbc_url' href='
http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html'>http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html</a>
; ">new style Wedding Dresses</a></strong><br><br />
<strong><a href="<a class='bbc_url' href='
http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html'>http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html</a>
; ">buy Wedding Dresses 2012</a></strong><br><br />
<strong><a href="<a class='bbc_url' href='
http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html'>http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html</a>
; ">discount Wedding Gowns 2012</a></strong><br><br />
<strong><a href="<a class='bbc_url' href='
http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html'>http://www.feelweddingdress.com/wedding-dresses-2012-c-61.html</a>
; ">Wedding Dresses 2012 sale</a></strong><br><br /></p></blockquote>
vishal13
Hi,
I am using following..But not working properly Please correct me..
rowHandle = th1.getDetail().getContents().get(0);
for(k = 0 ; k < rowHandle.getCells().getContents().size() ; k++){
cellHandle = rowHandle.getCells().getContents().get(k);
for(m = 0 ;m<cellHandle.getContent().getContents().size() ; m++){
dataItemHandle=cellHandle.getContent().getContents().get(m);
if(! list.contains(dataItemHandle.getResultSetColumn())){
removecol(k);
}
}
}
I am getting following error :
Cannot find function getResultSetColumn in object org.eclipse.birt.report.model.api.LabelHandle@be0739. (/report/method[
@name="
;beforeFactory"]#31) (Element ID:1)
How to get DataItemHandler from CellHandler ?
Please help me.
johnw
You don't need to modify the report design pragmatically to do this. You are making it more complicated than it needs to be. Use visibility expressions on the columns. The expression can come from Java objects. I just used report parameters in my example because it is easier to illustrate. <br />
<br />
So your visibility expression would be <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>list.contains("col1") == false</pre>
<br />
Assuming list contains a list of column name values. You give those names yourself (example: col1, col2, col3). <br />
<br />
Then you just copy that visibility expression into all the columns in your table.
vishal13
Hi,
But table is not getting shrunk.
Only data in that column and column heading(if we write same exprssion in header part)is not getting displayed.
Space for that column is still there.
I have used cell border while designing the table.
johnw
I wrote up an example of how to do this. Please refer to it on how to set column visibilities.
http://www.birt-exchange.org/org/devshare/designing-birt-reports/1487-birt-dynamically-hidingshowing-table-columns-in-a-report-design/