Multiselect

(4 posts) (2 voices)

Tags:

  1. Dev, Member

    Hi I am facing issues with the multiselect option. It works on a single select but wouldn't on a multiselect option. Returns error 'Multiselect query should be a procedure call.'

    Parameter query:

    SELECT 'ALL', 'ALL'
    UNION
    SELECT DISTINCT frequency,frequency FROM kennel_user.membership_addon WHERE frequency IS NOT NULL;

    Parameter implementated in report query:

    inMembershipType varchar(128)

    AND (CASE WHEN inMembershipType = 'ALL' THEN ms.frequency IN ('ANNUALLY','MONTHLY','BIANNUALLY','DAILY','QUARTERLY','WEEKLY','CUSTOM','LIFETIME')
    ELSE ms.frequency = inMembershipType END)

    Please provide any solution.

  2. myDBR Team, Key Master

    Would you like to use a multiselect or a checkbox?

    The difference between the two is that the multiselect allows you to search for possible matches from a larger set of choices. This requires user input, and therefore, the parameter query needs to be a stored procedure. The checkbox parameter displays a fixed set of options to choose from. The parameter query can be either a direct SQL query or a procedure. Based on your query, it seems you intend to use the checkbox parameter.

    Both the multiselect and the checkbox return a comma-separated list of selected parameters. If the parameter type is a string, the values are surrounded by single quotes. For example, if the parameters are integers, the parameter may look like: "1,3,5,10", whereas for a string type, it would give you: "'ABC','DEF','GHI'".

    Please refer to the examples on how to use the actual parameter in the report. Note that the condition "ms.frequency = inMembershipType" will not match multiple values. In MySQL/MariaDB, you can use the find_in_set function.

    --
    myDBR Team

  3. Dev, Member

    I was aiming to use multiselect option.

  4. myDBR Team, Key Master

    If you use the multiselect, create a parameter procdure that takes user input as parameter and that will return the chosen parameter options. See the example above.

    --
    myDBR Team


Reply

You must log in to post.