mohammad_awadat Posted December 26, 2007 Share Posted December 26, 2007 i need help to how pass parameter type Collection to query String Collection test; test.add(22222); test.add(2223322); test.add(22224562); --------------------- in query WHERE PATIENT_NO IN (TEST) thank you Link to comment Share on other sites More sharing options...
vinays84 Posted December 26, 2007 Share Posted December 26, 2007 If the parameter you pass in is of type collection, then you need to use $X{IN, param}.So if you have a parameter called testCollection of type Collection, your SQL would be:Code:... WHERE PATIENT_NO $X{IN, testCollection} ... Alternatively, you can use Strings for everything and hard put the SQL. So if you had a parameter called testCollection of type String to which you pass in the value "22222,2223322,22224562", your SQL would be Code:[code]... WHERE PATIENT_NO IN ($P!{testCollection}) ... Link to comment Share on other sites More sharing options...
mohammad_awadat Posted December 27, 2007 Author Share Posted December 27, 2007 when use WHERE PATIENT_NO $X{IN, testCollection}display this error-----------SQL IN clause missing parameter token--when useWHERE PATIENT_NO IN ($P!{testCollection}) display this error-----------Incompatible java.util.ArrayList value assigned to parameter test may be you can help me thank you Link to comment Share on other sites More sharing options...
vinays84 Posted December 28, 2007 Share Posted December 28, 2007 For the former, I'm sorry, I provided you with the wrong syntax. It should be $X{IN, <column>, <param>}, so:Code:WHERE $X{IN,PATIENT_NO, testCollection} For the latter, the parameter type must be String. So your backend java code would be:Code:[code]String testCollection = "22222";testCollection += ",2223322";testCollection += ",22224562";This would all you to properly use Code:[code]WHERE PATIENT_NO IN ($P!{testCollection}) Link to comment Share on other sites More sharing options...
mohammad_awadat Posted December 29, 2007 Author Share Posted December 29, 2007 thank you to much this way is work WHERE PATIENT_NO IN ($P!{testCollection}) Link to comment Share on other sites More sharing options...
mohammad_awadat Posted December 29, 2007 Author Share Posted December 29, 2007 thank you to much this way is work WHERE PATIENT_NO IN ($P!{testCollection}) 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