mwarner_2 Posted March 9, 2016 Share Posted March 9, 2016 Is it possible to default check all the checkboxes for a multi-select query input control? If so, how?I have a Jaspersoft Server defined input control, and it is a multi-select query. Say the underlying database query is something like 'select all cities where the temperature yesterday was above 62 degrees'. The query would have different results every day, which means that I don't know ahead of time what the possible results of that query will be.As it is now, in Jaspersoft, not selecting any values in a multi-select input control is the exact same thing as selecting all the values.But the customer wants all the checkboxes for that input control to be checked by default (when they first see the control).I have not seen any thing in Studio or Server where I can default check the checkboxes for a multi-select query input control.Thank you. Link to comment Share on other sites More sharing options...
kkriplani Posted March 10, 2016 Share Posted March 10, 2016 Hi,I suppose there are a couple of workarounds, let me list them as follows;1) either in the default expression of the multiselect parameter you can enter the values as; [1,2,3,4,5,6,7,8,9] this would check the values in the default expression. Now, Obviously if you have 300 distinct values to be checked you will have to list all of them, which is a bit cumbersome.2) The Other method is simpler. Declare another parameter as $P{abc} and in its default expression, write;$P{m_parameter} == "null" ? "select distinct <column> from table" : $P{m_parameter} [where m_parameter is the multiselect parameter and column is the values of the multiselect parameter from the table]The sample query for method 2 would look something like;Select * from table_2where $X{IN, <column_2> , ($P!{abc})}Hope this helps,KKriplani Link to comment Share on other sites More sharing options...
mwarner_2 Posted March 10, 2016 Author Share Posted March 10, 2016 I can't do method 1 because I don't know those values ahead of time (and those values change). So I am trying to do method 2.You talk about the query for method 2. By this you are referring to the JS Server input control query for the multi-select checkbox?What is table_2, and column_2?Is $P{abc} defined as a string, or a collection, or as a what? And by doing this method, then all the checkboxes for $P{m_parameter} will be checked (instead of the usual unchecked)??? Link to comment Share on other sites More sharing options...
kkriplani Posted March 15, 2016 Share Posted March 15, 2016 Okay.The answer to your questions are as follows;1) The query is the main/dataset query and not the input control query. The query just shows how to implement the IN condition and the use of conditional parameters ( to know more, read my answer on this link) in jasperreports. 2) table_2 and column_2 are just table and column used for the main query (as i stated in point 1 that its just an example).3) Yes, the conditional parameter ($P{abc}) would be a string while the multiselect parameter would be a collection.Sorry, for the late response. Let me know if you have any more queries,KKriplani. Link to comment Share on other sites More sharing options...
mwarner_2 Posted March 15, 2016 Author Share Posted March 15, 2016 And by doing this method, then all the checkboxes for $P{m_parameter} will be checked (instead of the usual unchecked)??? Link to comment Share on other sites More sharing options...
neetu.guglani Posted August 3, 2016 Share Posted August 3, 2016 Hello, I am also facing the same issue wherein i want all the values in the parameter to be selected by default. So, do we have any work around? Please share Thanks Neetu Link to comment Share on other sites More sharing options...
Solution kkriplani Posted August 3, 2016 Solution Share Posted August 3, 2016 Hi,Okay i seemed to have found a solution, give it a try.All you have to do is as follows;1) keep the default expression of the parameter fetching value from multi-select Input control as blank, i.e, insert no values.2) And keep the multi-select input control as non-mandatory.The behaviour of multi-select that I observed was, non of the boxes will be checked but the query would pass the value as :"where 0=0"That means, all the selections are considered. Regards,KKriplani Link to comment Share on other sites More sharing options...
kkriplani Posted August 9, 2016 Share Posted August 9, 2016 If you vote down an answer, that is fine. At least state the better resolution you have as that would help others, a vote down wouldnt help that much.Regards,KKriplani Link to comment Share on other sites More sharing options...
mwarner_2 Posted August 9, 2016 Author Share Posted August 9, 2016 I do not have a resolution to my question. Wish there were one. I do appreciate you being the only person to attempt to answer this question.I down voted your solution because as you said "none of the boxes will be checked". And my question was about how to check all the boxes.I would remove my negative vote, but there is no way to reset it back to zero. 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