Pre-populated parameters (Check-boxes)

(5 posts) (2 voices)
  1. Avatar, Member

    Hi,

    Is there a way to pre-populate parameters? (I'm not talking about defaults).

    Detail/Example:
    I have a report that has a checkbox parameter.
    This parameter has 3 values (A, B, C).
    When you open the report, the parameter page is shown and by default all three options are "unchecked".
    Is it possible (through javascript or other methods) to have the 3 checkbox's already "checked" (pre-populated) when the report is opened for the first time.

    (I would like to achieve this with other parameters as well, for example have the "select all" selected for the selection list parameter but happy to start with the checkbox for now).

    Thanks,
    Avatar.

    Posted 1 week ago #
  2. myDBR Team, Key Master

    Sounds exactly like the defaults functionality. What is the difference you are looking for to the defaults?


    myDBR Team

    Posted 1 week ago #
  3. Avatar, Member

    Apologies for the unnecessary forum as you are correct, that is exactly the function of the defaults.
    However I am going to elaborate my confusion and solution for the next user who has the same question and stumbles upon my post.

    The confusion:
    The documentation found here (See myDBR Documentation → Default values) is not that clear on how to implement defaults when you have a parameter based on a query. Further more 90% of the examples and solutions found on the forum are based on having a query that selects a "value_ID" and a "value_TEXT" which is not always possible.

    The solution:
    * My parameter query: The query below returns a unique list of text values which will be turned into a parameter on the report. In my case I used checkbox's


    select distinct [your text column]
    from [your database table]
    order by [your text column]

    * My default parameter query : The query below creates a default list of text values which will then be used to auto-check/pre-populate the checkbox's on your report.


    select group_concat(concat("'",[your text column],"'"))
    FROM(
    select DISTINCT [your text column]
    from [your database table]
    ) x

    Now when you assign the "parameter" and the "default parameter" to your report,all the values will be "checked" by default when you open your report.

    Thanks again for the great platform,
    Avatar.

    Posted 6 days ago #
  4. myDBR Team, Key Master

    We've improved the documentation on the topic. Thanks for the feedback.

    If you want to have all checkboxes to be checked by default, you can do that already in the parameter query (no need to use defaults):

    select id_col, visible_column_name, null, 'checked'
    from yourtable

    You can still use the defaults and with the new build, you do not need to concatenate the values, you can just select multiple rows. In simples form:

    select id_col
    from yourtable

    --
    myDBR Team

    Posted 6 days ago #
  5. Avatar, Member

    That is great!

    Appreciate the fact that you are continuously improving the product.

    Posted 6 days ago #

Reply

You must log in to post.