PP Ocean Posted April 3, 2020 Share Posted April 3, 2020 Hi Does Jasper Studio support show/ hide functionality with Table component? I am creating a report from studio. I need to show/hide table based on parameter.For example, I have 2 input controls (A&B) and 2 tables (Table1 & Table2). 2 tables are created with in single JRXML with 2 separate datasets. When I select any value in Input Control A, Table 1 should be visible and Table 2 should hide. Similarly, When I select any value in Input Control 2, Table 2 should be visible and Table 1 should hide.Table 1 and Table 2 are created using seperate datasets, and parameter A passed to Table 1 and parameter B passed to Table 2. I knew show/ hide will work at column level but not sure whether it is possible with table. I have tried various methods but didn't work.Does anyone know how to achieve this? Link to comment Share on other sites More sharing options...
jgust Posted April 3, 2020 Share Posted April 3, 2020 You can create a Table1 and Table2 subreports. Then suppress depending on the parameter value. Link to comment Share on other sites More sharing options...
PP Ocean Posted April 4, 2020 Author Share Posted April 4, 2020 Then what condition I need to give at each table to show and hide? Link to comment Share on other sites More sharing options...
Solution jgust Posted April 4, 2020 Solution Share Posted April 4, 2020 Let's say you have a boolean parameter called $P{ShowTableA} with a default value of 'true'. <parameter name="ShowTableA" class="java.lang.Boolean"> <defaultValueExpression><![CDATA[true]]></defaultValueExpression> </parameter>[/code]Depending on the value of that parameter you can use the "Print When Expression" on the subreport to suppress or show it. This condition will Show Table A $P{ShowTableA}.equals( true )[/code] This condition will show Table B $P{ShowTableA}.equals( false )[/code] 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