therockita Posted May 1, 2010 Share Posted May 1, 2010 Hello,I'm designing a report template made of one MASTER report and one SUBreport, both with xml as datasource.The context is the following: I pass a JRXMLdatasource with initial path of /test/questions/question (the second parameter of the constructor) to the MASTER report .I pass the same xml datasource to the subreport (through the built-in parameter $P{REPORT_DATA_SOURCE}), this time with a different path /test/questions/question[@questionId=$P{questionId}]/selectedChoicesThe xml datasource represents the answers that a student selects in a multiple choice test.Obviously a student might not select any choice of one question. In this case the XPath test/questions/question[@questionId=$P{questionId}]/selectedChoices will return an empty node set and the subreport won't be "started". This behaviour is ok.Now, this is my problem:I need additionally to this to print the textField "User has not selected any choice". This must happen only when the subreport won't be generated because of the empty node set.I have tryed many strategies, like using variables combined with the printWhenExpression, but it didn't succeed. How can I do!!?!???! I feel like if I'm missing the simple solution. Any help is welcomed. Link to comment Share on other sites More sharing options...
pablodc Posted May 2, 2010 Share Posted May 2, 2010 Hi I think you must use the "No data" band. To enable it search in the report properties and in the "When no data" select "No data section" instead of "blank page", then expand the "No Data" section and put on it the message you want to display when the XPath don't returns any information. Hope this helps you.Grettings from Argentina. Link to comment Share on other sites More sharing options...
therockita Posted May 2, 2010 Author Share Posted May 2, 2010 Hi Pablodc, Thank you very much for your great advice (I always realize there's always something you don't know about JR). It worked perfectly! (for the people having the same problem, the no data section you have to activate is the one in the subreport). Greetings from Italy (from a peruvian guy...)! Chau! 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