joanfabre Posted November 25, 2010 Share Posted November 25, 2010 Hi,Using JRXmlDatSource I've used parameters inside the XPath query string for the whole report without any problem but... Is it possible to include a report parameter inside the XPath expression that comes within the field description?Example: <field name="packetName" class="java.lang.String"> <fieldDescription><![CDATA[/doc/index/packet[@order=$P{Order}]/name]]></fieldDescription></field>It seem it doesn't work and I'm not sure if I'm doing something wrong or if JRXmlDataSource doesn't accept parameters (or variables) inside such expressions.If not, maybe I could accomplish the same results using a variable? Is it there any helper function to make an Xpath query to the XML document from the DataSource? Thanks in advance, Code:<field name="packetName" class="java.lang.String"> <fieldDescription><![CDATA[/doc/index/packet[@order='$P{Order}']/name]]></fieldDescription></field> Link to comment Share on other sites More sharing options...
tonynys Posted March 13, 2011 Share Posted March 13, 2011 I have exactly the same need; I have a field with an ID and want to use it like this <field name="guarantorName" class="java.lang.String"> <fieldDescription><![CDATA[data/Parties[identifiers/Primary/@Id=$F{guarantor}]/@Name]]></fieldDescription> </field> I've seen the OrdersReport sample in jasper, where a query string is used in the same way with $P{customerID} and this works.But inside the xpath expression above, it doesn't work. Any ideas ? Code: <field name="guarantorName" class="java.lang.String"> <fieldDescription><![CDATA[ResolvedDirectoryData/Parties[identifiers/Primary/@Id=$F{guarantor}]/@Name]]></fieldDescription> </field> 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