paubarnes Posted March 14, 2008 Share Posted March 14, 2008 I am a new iReport developer. I would like to create parameters referencing the following three columns in a table. I am retrieving the data using SQL script: OnlineAmount, OfflineAmount, DonationType (online, offline) How do I create parameters to display (online, offline or both)using iReports. In other words, the users should be able to select from any one of these two options(online, offline) or both? I am not sure if I need to create 1 parameter with three options or three parameters: Any suggessions (including examples) would be greatlyappreciated. thx.paubarnes Link to comment Share on other sites More sharing options...
mdahlman Posted March 15, 2008 Share Posted March 15, 2008 paubarnes, I can't quite tell what you're asking. Are you trying to use a parameter to filter what data gets returned from the database? Or do you always return OnlineAmount and OfflineAmount but you want to let the use specify which fields get displayed? You could create 2 boolean parameters: one called Online and one called Offline. The user could set these with a checkbox control. Then you could control which field is displayed using the Print When expression for the fields. Your idea of using a single parameter with 3 allowed options could also work. Either way the idea sounds fine. Write back with more detail if you're encountering a specific problem. Regards,Matt Link to comment Share on other sites More sharing options...
paubarnes Posted March 16, 2008 Author Share Posted March 16, 2008 Matt, I would like the user to specify which field gets displayed. The user should select from the filter page – OnlineAmount, OfflineAmount or All (all should displays both online/offline). OnlineAmount and OfflineAmount are both fields from the database. I guess I would need to create a variable/parameter for All. How would display these fields and link them to the actual fields in the database? eg: dropdown box or checkbox onlineofflineall Please provide me with an example – I am new to iReports. Thanks in advance for your help paubarnes Link to comment Share on other sites More sharing options...
paubarnes Posted March 20, 2008 Author Share Posted March 20, 2008 Can anyone help with this issue. I have to get this report done by the end of the week. Thanks. Link to comment Share on other sites More sharing options...
Pedja Posted March 20, 2008 Share Posted March 20, 2008 You can create one parameter (for example $P{DISPLAY_MODE} set it to BigDecimal type), read all the fields from the db, and selectively display them based on the parameter value. Let's say that the parameter value 0 is for offline, 1 for online and 2 for both; in the fields you want to print if the offline is selected, in "Print when expression" put ($P{DISPLAY_MODE}.intValue()==0 || $P{DISPLAY_MODE}.intValue()==2), and in the fields you want to print if the online is selected put ($P{DISPLAY_MODE}.intValue()==1 || $P{DISPLAY_MODE}.intValue()==2). I hope this helps! Pedja Link to comment Share on other sites More sharing options...
Faabris Posted April 16, 2008 Share Posted April 16, 2008 hi paubarnes That interested me too!Have you done it? have you a example for me? thxFaabi Link to comment Share on other sites More sharing options...
frijolita Posted May 9, 2008 Share Posted May 9, 2008 Hi, have you found a solution for your problem? i have the same question Thanks! 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