max_max_mir Posted August 11, 2010 Share Posted August 11, 2010 I am trying to order by a column in my SQL query, but this column I am trying to order by depends on a parameter to be supplied by the end user. Any suggestions how to do it?SQL Query: Select * from table1 order by $P{param1}The problem is, $P{param1} is of type String, and in the query, it gets translated to a string with quotes. On the other hand, an expression like Select * from table1 order by $P{param1}.equals("column1")?column1:column2 doesn't work either.Post Edited by max_max_mir at 08/11/2010 17:30 Link to comment Share on other sites More sharing options...
robsil Posted August 11, 2010 Share Posted August 11, 2010 Try $P!{param}. The '!' indiciates that it should be a literal string replacement which should solve your problem Link to comment Share on other sites More sharing options...
max_max_mir Posted August 11, 2010 Author Share Posted August 11, 2010 Thank you! That worked! 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