What is the $P!{} Parameter , How it is used in Jasper reports

0

Hello All,

I'm Curious to  know about this special Parameter $P!{}.
I came to know that it is used :- "To send pieces of raw SQL or to pass the entire SQL string to execute" ,

Could any one suggest me simple report with an example how to use it.

Thanks.
 

santosh.audi19's picture
Joined: Sep 9 2015 - 9:58am
Last seen: 1 year 2 months ago

2 Answers:

0

Lets suppose I have the following query,

Select L_name, 
age_1,
$P!{check} as Characteristic
from table


This paramater allows me to view the various characteristics of the person I am refering above. It would be dependent on another parameter, let us call that parameter as $P{value}. 

In the default expression of the parameter "check", I could define the following;

$P{value}==1 ? "Physical_strength" : $P{value}==2 ? "IQ": "Nature";

Depending on the various values of $P{value}, the parameter "check" will input the values into the query and mind you, the above three stated characteristics are nothing but the table columns, so basically we are displaying different columns based on the parameter "value".

For instance, the parameter "value" was entered as 2, so my running query would look like (which you can check in the logs);

 

select L_name, age_1, IQ as characteristics from table

Hope this explains all.

Regards,
KKriplani

kkriplani's picture
858
Joined: Sep 4 2015 - 2:18am
Last seen: 3 weeks 17 hours ago
0

Check the following page. It contains explanation and a link to a sample.

http://jasperreports.sourceforge.net/sample.reference/query/

hozawa's picture
52422
Joined: Apr 24 2010 - 4:31pm
Last seen: 5 months 6 days ago
Feedback