-1

In iReport, i want to put the sql query in my parameter expression editor as following.

(!$P{securityGrading}.equals("0")) ? "SecurityGrading- " + "select description from [KRISADMIN].SecurityLevel where Level = $P{securityGrading}" : "SecurityGrading- Default to all"

But the iReport can't execute my sql query. I know it doesn't recognize my sql query since i'm using double quote but how do I get my query works in it?

user2064467
  • 375
  • 1
  • 4
  • 13

1 Answers1

0

The Problem which I see is in the addition of the parameter value.

Correct way would be If Level Column is integer then -

(!$P{securityGrading}.equals("0")) ? "SecurityGrading- " + "select description from [KRISADMIN].SecurityLevel where Level =" + $P{securityGrading} : "SecurityGrading- Default to all"

If Level column is of type varchar

(!$P{securityGrading}.equals("0")) ? "SecurityGrading- " + "select description from [KRISADMIN].SecurityLevel where Level ='" + $P{securityGrading} +"'" : "SecurityGrading- Default to all"

You need to take care that the dynamic values supplied from the parameters in ireport need to find the legit SQL.

Hope that this helps.

Ankur
  • 318
  • 3
  • 7