cherieh Posted August 29, 2011 Share Posted August 29, 2011 In this instance, I have to use a csv file as my source. Can I sort the report based on a variable instead of a field? I am using iReport v.3.7.4. Please help. Everything i have read in the forums and books is leaning to no but thought there may be a way i am overlooking. Link to comment Share on other sites More sharing options...
despec Posted August 29, 2011 Share Posted August 29, 2011 I often use a an Ireport variable in my SQL statements. This gives my users the ability to sort on different fields of the report. In this case, create a "Parameter" instead of a variable. Here's a shor example:I have a parameter called "user_choice" which I default to "city". The user may change this by selecting from a list, say "City", "State" or "Zip"...The SQL qould look something like this:select name, address. city, zipfrom phone_bookorder by $P!{user_choice} Make sure to include the "!" point. David Link to comment Share on other sites More sharing options...
cherieh Posted August 30, 2011 Author Share Posted August 30, 2011 David -Thanks for your quick response. However, I do not have access to create the sql so i am stuck with the static csv file. Back to the drawing board i guess.Cherie Link to comment Share on other sites More sharing options...
tomstieger Posted January 23, 2012 Share Posted January 23, 2012 Thank you for this example. I was getting an error when I was trying to use the order by clause with a parameter. I need the "!" 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