Clarity

 View Only
  • 1.  Jaspersoft Report

    Posted Sep 09, 2020 06:42 AM

    Hi All,

    I am newbie in Jaspersoft reporting and need some help regarding setting up jaspersoft report parameter. i was able to create a parameter using single value and report runs properly. 

    Now i have requirements to include few more optional parameters which when selected should provide data as per the filter selected. 

    1. I created a integer parameter say project_key 1, and set up it as java.util.collection type. 
    2. Checked 'prompt = true'
    3. added $X{} condition in the sql query like 

    And $X{inv.id,project_key1}


    4. when i run the query and will not provide any value to the optional parameter it give the result i.e shows all the value. 
    5. even after providing value in the prompt for optional parameter the data is not getting filtered. 

    Am i missing something here? Tried to look into OOB jaspersoft report but didn't help much, also i need to run these report from reports and jobs so do i need to create 'input control(query based)' for this parameter??

    thanks in advance. 



    ------------------------------
    Regards,
    Sonal Vaidya
    ------------------------------


  • 2.  RE: Jaspersoft Report
    Best Answer

    Posted Sep 14, 2020 11:32 AM
    Edited by Christopher Hackett Sep 18, 2020 04:12 PM
    Hello Sonal, did you also make sure the parameter xml is in the source?

    typically, something like...
    <parameter name="Project_Key_1" class="java.util.Collection" nestedType="java.math.BigDecimal"> <parameterDescription><![CDATA[Project]]></parameterDescription> </parameter>​
    ​​then in the query
    AND $X{IN, inv.id, Project_Key_1}​


    when you have the xml parameter code in the source, jaspersoft will add the parameter for you, you don't need to add it manually in the Parameters tab

    Parameters tab

    for the reports and jobs you use lookups... just look at the query code for project and then create the input control off that. if you want to use the checkbox for populate project then you must include that into the query. if you don't need that, then here is one i have for the project without the need for the checkbox...these are all projects, no programs, if you want you can just see all active projects, depends on your needs.
    SELECT p.id investment_key , p.name investment_name , p.code investment_code FROM inv_investments P INNER JOIN inv_projects pp ON pp.prid=p.id WHERE pp.is_program = 0 AND pp.is_template = 0 ORDER BY p.name​

    Then, you can use the ootb lookup or make your own. Those are the ones that start with Report ().
    Report lookups

    I hope this helps a little. Feel free to ask more questions or DM.

    Keri