biqll Posted February 23, 2009 Share Posted February 23, 2009 Hi, Is there any way to put a parameter (which is node number) into field description in iReport? For example i have xml like This : <Table><tabDescription>some Description 1<t/abDescription><Row>1</Row><Row>2</Row> <RowSum>1</RowSum> <RowSum>2</RowSum></Table> <Table><tabDescription>some Description 2<t/abDescription><Row>3</Row><Row>4</Row> <RowSum>3</RowSum> <RowSum>4</RowSum></Table> Tables are same type so i am using subreport with DataSource with selected node "/Table"I would like to put parameter into subreport and get just one of values from 2nd node (Row, RowSum) same like values from expr. "Row[2]" and "RowSum[2]" but the XPath should be dynamic.In Field Description i have select expression <fieldDescription><![CDATA[/Row['"+$P{nodeNumber}+"']]]></fieldDescription>but it show always first node.Question is how to put properly node number from parameter into Xpath expression in Field? Link to comment Share on other sites More sharing options...
kaster Posted February 23, 2009 Share Posted February 23, 2009 Try set in your Subreport selectExpression something like this Code:"((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).dataSource("/root/Table/Row["+$P{nodeNumber}+"']")" Link to comment Share on other sites More sharing options...
biqll Posted February 23, 2009 Author Share Posted February 23, 2009 I know what u mean but it's not a solution for my problem. In my case table is more complicated and fields are deep in XML structure in other locations. For example some value can occur for few years in this type - this type is representing column in table. But the other price for same year occurs in other branch of XML and its in exactly same node number like this first. In this soution i should have a template report with a lot other subreports. Every of this would have parametrized datasource and every would represent just one field. I don't want do like this. I want to put a parameter into Field Description where is Xpath selection for this field so i could take value from this node which number is parameter Link to comment Share on other sites More sharing options...
andfedotov Posted May 14, 2009 Share Posted May 14, 2009 Any luck with this? I have the same issue... Link to comment Share on other sites More sharing options...
andfedotov Posted May 14, 2009 Share Posted May 14, 2009 So the question is:Is it possible to use expression (and so use $P{} or $F{} ) in the field description or description should be static only?Dynamic description would be much, much wanted! Especially when dealing with XmlDatasource... Link to comment Share on other sites More sharing options...
lucianc Posted May 20, 2009 Share Posted May 20, 2009 andfedotovWrote: So the question is: Is it possible to use expression (and so use $P{} or $F{} ) in the field description or description should be static only? Dynamic description would be much, much wanted! Especially when dealing with XmlDatasource... Currently that's not supported. It would be useful, please log it as a feature request so that we have it on our radar.Regards,Lucian Link to comment Share on other sites More sharing options...
lenalex Posted August 26, 2012 Share Posted August 26, 2012 andfedotovWrote: ... Is it possible to use expression (and so use $P{} or $F{} ) in the field description or description should be static only?... Solution is to use $F{} in VARIABLE description and then to use variable some times Code: Post Edited by lenalex at 08/26/2012 20:08 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