Jump to content
We've recently updated our Privacy Statement, available here ×

jfabre

Members
  • Posts

    2
  • Joined

  • Last visited

jfabre's Achievements

Newbie

Newbie (1/14)

  • First Post Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. The report result is a blank page because you aren't using any datasource. If you change the line: print = filler.fill(new HashMap()) by this one: print = filler.fill(new HashMap(), new JREmptyDataSource()); It'll work. Joan
  2. Hi, I'm newbie in JasperReports, but I followed your indications and.. it works!. First I defined the input parameter (PARAM1) that comes from a JasperServer multi-selection check-box. I defined it as you mentioned (java.util.Collection datatype). Then I defined a second parameter (PARAM2), and on its default value Expression I used: $P{PARAM1}.toString().replace('[','(').replace(']',')') Finally, I can use this second param in the SQL expression as you mentioned. ...AND FIELD_NAME IN ( $P!{PARAM2} ) I don't know if in an SQL expression you can use a variable instead of a parameter, but using a "dummy" parameter, it works. Greetings csbac wrote: Hello, I understand your problem because I have just been trying to do the same ... There are two problems there. * JasperServer passes Multi-Selection values to the Jasper report in a class that implements Collection. Thus, if you define the report parameter as java.util.Collection, you can access it from the report and print it etc. As a default value in the parameter definition, you can use, e.g., Collections.singletonList("entry") or Arrays.asList(new String[] {"entry1", "entry2" }). This works for me w/o any problem. * If you want to use this parameter in an SQL query, like in SELECT * FROM TABLE WHERE idSth in ($P!{param}), you need to look at the post http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=8&id=19639 The only viable way is to convert the multi-selection list (Collection) in a string list, and set this as a parameter. Take care of the "!" in $P!{PARAM}, though. Otherwise, the string is passed as JDBC parameter, and that one only places the single string into the "in (?)", not as a list of items/strings. I will have to find out how to best do this conversion; toString() does not work, as it writes [1,2,3] in case of an Integer collection ... maybe a replaceAll call afterwards? Yours, Sebastian<br><br>Post edited by: csbac, at: 2007/03/16 12:44
×
×
  • Create New...