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 all
SELECT 2 v from dual union all
SELECT 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.0
If there is anybody who has the same thing?
3 Answers:
P_C is my WHERE clause
As 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 false
I want to remove(or modify) WHERE clause in SQL depending on whether the parameter P_P is set or not.
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}