Default selection of multiple checkbox.

(13 posts) (2 voices)

Tags:

  1. fullerb18, Member

    I have report which will contain list of checkboxes. By default I want those checkboxes to be selected. Data for those check box is from the DB with multiple rows.

  2. myDBR Team, Key Master

    Hi,
    you can use a comma separated list of ID's for the default.

    --
    myDBR Team

  3. fullerb18, Member

    Can you please give me an example for that.

  4. myDBR Team, Key Master

    Hi,
    if your ID's are numbers you can use:

    select "1,3,5"

    if your ID's are strings, use:

    select "'HKG','KWT'"

    --
    myDBR Team

  5. fullerb18, Member

    This is my parameter query and it doesn't work.

    SELECT "'Source No.','Name','Address','Country of Origin','''mail','Phone','Price'";

  6. myDBR Team, Key Master

    Is that the parameter query or the default value? How does the other query look like?

    --
    myDBR Team

  7. fullerb18, Member

    SELECT "'Source No.','Name','Address','Country of Origin','''mail','Phone','Price'";

    This is my parameter query and it should display all the values as checkboxes. And by default it should be checked(selected). But the user may check or uncheck the values.

  8. myDBR Team, Key Master

    Hi,
    you will have two separate things. First the parameter query which defines the checkbox values (and optionally the ID's). Secondly, you can define a default value for the parameter.

    The parameter query is a simple result set. In your case that would be:

    select 'Source No.'
    union
    select 'Name'
    union
    select 'Address'
    union
    select 'Country of Origin'
    union
    select 'mail'
    union
    select 'Phone'
    union
    select 'Price'

    You could use a separate parameter table so the values would be easier to maintain.

    select value
    from myparam

    The default value is a single value. In case of checkboxes the value is a comma separated list of selected ID's or values if ID's are not used. In your case if you want all values to be checked by default:

    select "'Source No.','Name','Address','Country of Origin','mail','Phone','Price'"

    Again, if you use a parameter table the parameter maintenance is easier:

    select group_concat(concat("'",value,"'"))
    from myparam

    --
    myDBR Team

  9. fullerb18, Member

    From your above post I understood the I have to put the below thing in the parameter query. If I am wrong kindly correct me.

    select 'Source No.'

    union

    select 'Name'

    union

    select 'Address'

    union

    select 'Country of Origin'

    union

    select 'mail'

    union

    select 'Phone'

    union

    select 'Price';

    select "'Source No.','Name','Address','Country of Origin','mail','Phone','Price'";

  10. myDBR Team, Key Master

    The parameter query defines which values are selectable by the user. In your case this would be:

    select 'Source No.'
    union
    select 'Name'
    union
    select 'Address'
    union
    select 'Country of Origin'
    union
    select 'mail'
    union
    select 'Phone'
    union
    select 'Price'

    If you wish to set default values (in your case for the checkbox parameter), you use the default query to set that. See above the example of this.

    --
    myDBR Team

  11. fullerb18, Member

    I can understand that parameter query is to display the values to be selected by the users. My Questions is where do I want to place the default value query in the report (below query).

    select "'Source No.','Name','Address','Country of Origin','mail','Phone','Price'";

  12. myDBR Team, Key Master

    In Parameter queries, there is a separate selection for defaults. See myDBR Documentation → Default values.

    Once you define the default there, it is shown as selectable default in report parameters.

    --
    myDBR Team

  13. fullerb18, Member

    Thank you. It works fine. And sorry for pilling it on.


Reply

You must log in to post.