Jump to content
Changes to the Jaspersoft community edition download ×

Difference between $P!{var} and $P{var}


Recommended Posts

By: den chong - den06boy

Difference between $P!{var} and $P{var}

2003-09-30 02:58

ANyone can explain to me what the diff between these 2 parameters : '$P!{var}' and '$P{var}' ?

Whats the "!" stands for?

 

 

By: Giulio Toffoli - gt78

RE: Difference between $P!{var} and $P{var}

2003-09-30 03:44

 

When you simply use $P{param}, jasperreports use a prepare statement, and then pass $P{param} as SQL parameter.

 

When you use $P!{param}, the parameter is processed to generate the final SQL string to execute (for this reason using $P!{} syntax you can pass entire portions of SQL, or the entire query too!)

 

Giulio

Link to comment
Share on other sites

  • 4 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

What are the benefits of using either approach? It seem s to me that you would want to always use $P!{var} would you not?

 

I have a situation where I have the WHERE clause being modified as

 

WHERE name='$P!{PERS_NAME}' AND ID='$P!{PERS_ID}'

 

But at some times I dont want the ID check used so I have that all extracte to an even bigger parameter...

 

WHERE name='$P!{PERS_NAME}' $P!{ID_BIG_PARAM}

 

Where I have ID_BIGPARAM =

""

or...

" AND ID='123' "

 

So is it more efficient to use $P!{var} or $P{var} for the name parameter?

 

Thx,

Rob

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...