alexshtanin Posted October 18, 2019 Share Posted October 18, 2019 In Jasper Studio, i created new Jasper Report with SQL srcript ```select * from(SELECT 1 v from dual union all SELECT 5 v from dual union all SELECT 4 v from dual union allSELECT 2 v from dual union allSELECT 3 v from dual) da$P!{P_C}```there are two Parameters:``` <parameter name="P_P" class="java.lang.Boolean"/> <parameter name="P_C" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[iF($P{P_P},"where da.v =1","")]]></defaultValueExpression> </parameter>```When i run this report in Jasper Studio then everything is works fine and result is as expected:```_________TEST REP|________|V |________|1 |2 |3 |4 |5 |```But on JasperServer i get an error:```There was an error on the server. Try again or contact site administrators. (Error UID: 16864f27-a17a-43d1-8ed6-4386b52f57a0)```If i delete `$P!{P_C}` from SQL script, every thing works fine.Version of TIBCO Jaspersoft® Studio is 6.9.0 Version of Jasper Server is 7.2.0If there is anybody who has the same thing? Link to comment Share on other sites More sharing options...
danoldenkampgmail.com Posted October 18, 2019 Share Posted October 18, 2019 What are you feeding into the P_C string?If it's a long string value make sure to add the ! as $P!such as if you were feeding in an order by clause.order by $P!{P_C} Link to comment Share on other sites More sharing options...
alexshtanin Posted October 21, 2019 Author Share Posted October 21, 2019 P_C is my WHERE clauseAs you can see i've used ! in my SQL with parametr $P!{P_C}. The value of P_C parametr is set to where da.v =1 when P_P parametr is true and "" when P_P parametr is falseI want to remove(or modify) WHERE clause in SQL depending on whether the parameter P_P is set or not. Link to comment Share on other sites More sharing options...
danoldenkampgmail.com Posted October 21, 2019 Share Posted October 21, 2019 Such as: where (da.v =1 and $P{P_P} = 'true')or(da.v like "" and ${P_P} = 'false') In my limited experience I have only been able to feed parameter arrays as strings into SQL if it is within a clause followed by the clause name.where $P!{example}order by $P!{example}group by $P!{example}having $P!{example} 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