Search code examples
jasper-reports

How to display different reports in Jasper Reports based from parameter input?


I was wondering if it is possible to display different results(reports) using a parameter. Let's say the parameter takes 2 values. Option 1 displays 1 report while option 2 displays a different one. Appreciate for your input.


Solution

  • Instead, try to put your two different content into a single report. Say put report 1 content into a single frame (Frame1) and Report2 content into another frame (Frame2). Now try using print when condition to display your dynamic content based on the parameter as

    for Frame1

    $P{Paramter1} != null && $P{Parameter} == null

    for Frame2

    $P{Paramter1} != null && $P{Parameter} != null

    Hope this should solve your problem.