hovendal Posted July 23, 2009 Share Posted July 23, 2009 Hi all, I am working on a report in which columns can be chosen arbitrarily to be shown. I am still designing it in jrxml, but calculating the positions and sizes of the columns based on which columns to be shown, and store them in my BeanDataSource. But this proves to be a bit of a problem, since i cant use field values in e.g. x="" attributes - for instance see code below.Can this be done in anyway, or must a static integer be provided? That seems kinda weird if variables cant be used here since it would be obvius to use them to dynamically set widths and positions...I hope someone can help! Best regardsHovendalCode: <textField> <reportElement x="<![CDATA[$F{posM2}]]>" y="6" width="50" height="21" forecolor="#FFFFFF" > <printWhenExpression><![CDATA[$F{showM2}]]></printWhenExpression> </reportElement> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$P{REPORT_RESOURCE_BUNDLE}.getString("report.roomlist.m2")]]></textFieldExpression> </textField> Link to comment Share on other sites More sharing options...
hovendal Posted August 5, 2009 Author Share Posted August 5, 2009 Really, it is not possible? I have a hard time understanding why this can be done in a more flexible way.... Link to comment Share on other sites More sharing options...
Teodor Danciu Posted August 5, 2009 Share Posted August 5, 2009 Hi, JasperReports has a clear separation between data and layout. I'd say this is a good thing. JasperReports hides all the layout logic complexity from the users, leaving them with only the responsability of displaying the data they want.If we give you the possibility to provide the X value at runtime, you'll basically no longer need a reporting engine, because you'd be writing one yourself. There is nothing wrong with that, but then why use JasperReports? Of course, I'm exagerating things a bit, but just so that you see my point. On our roadmap, there is a feature called "dynamic table" or something like that. Basically we are going to create a table component in which you could declare dynamic columns that display conditionally and move or resize themselves according to layout rules you specify. It will be much better than letting you specify the X value, which by the way is not clear to me if it absolute or relative to something. Until then, you have to go with report templates created dynamically using the API at runtime. Another approach would be to use a crosstab, but it would require a certain amount of tricks to simulate a table that is not acutally a crosstab, but just a dynamic table. I hope this helps.Teodor Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now