Home
Intelligence (Analytics)
Setting a table cell visibility
Lesbea
Hello to all , I am a new user of Birt and have got on very well so far. However I need some help on this problem that is getting to me.
I have a dataset with some data in for a report
the data set has a field called XLINECLASS which is set to 'H' for header or 'S' for summary.
I have several fields which have values in i.e. XGBP , XEUR etc.
I have set a table up to have the fields from the data set including XLINECLASS which has been set to non-visible.
Ok with me so far.
Now my problem is that I do not want the cells XGBP XEUR on a row to be visible when the XLINECLASS value for that row is 'H'.
Could somebody work out the method to use, I have tried the function on a cell by setting hide cell to yes and using row["XLINECLASS] = 'S' to condition the cell but that does not seem to work for me
Do I need a script on the cell for onRender if so can sombody help on this please.
Many thanks to all you experts out there in advance.
Find more posts tagged with
Comments
birtq
Hi
Try this out :
Add this script in initialize.
importPackage(Packages.org.eclipse.birt.report.model.api);
importPackage(Packages.org.eclipse.birt.report.model.api.elements);
delm = reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("ql");
hr = StructureFactory.createHideRule();
hr.setFormat("html");
hr.setExpression("if( row["XYZ"] =2 ){true;}else{false;}");
ph = delm.getPropertyHandle("visibility");
ph.addItem(hr);
Changes required in:
line 3: change "ql" to the name of the data cell where you want to hide/unhide data.
line 6: ( row["XYZ"] =2 ) to the required condition.
:-)
Regards,
birtq
Lesbea
I am getting errors with the suggested script
importPackage(Packages.org.eclipse.birt.report.mod el.api);
importPackage(Packages.org.eclipse.birt.report.mod el.api.elements);
delm = reportContext.getReportRunnable().designHandle.get DesignHandle().findElement("XGBP");
hr = StructureFactory.createHideRule();
hr.setFormat("html");
hr.setExpression("if( row["XLINECLASS"]= 'S'){true;}else{false;}");
ph = delm.getPropertyHandle("visibility");
ph.addItem(hr);
when I run view in web-browser
All the data is displayed
birtq
Hi
Go through the example present in the report as attachment.might be that will help.
also if u want to use equal(=) operator use "==".
Regards,
birtq
mwilliams
Hi Lesbea,
The visibility condition for a report item should work just fine with a condition like "if (row["XLINECLASS"] == 'H'){true} else{false}.
Are you wanting the entire row hidden when "XLINECLASS" equals 'H'? or are you just wanting a couple columns, XGBP and XEUR, hidden in a row with several more columns still visible?