SSRS Error: Cannot add multi value query parameter '@CountryId' for dataset 'ds_GetPractice' because it is not supported by the data extension. (rsErrorAddingMultiValueQueryParameter)

Tu YuHsuan 1 Reputation point
2021-06-01T04:01:14.063+00:00

Hi,

I am using ODBC to connect PostgreSQL in SSRS.
and face issue
Cannot add multi value query parameter '@CountryId' for dataset 'ds_GetPractice' because it is not supported by the data extension. (rsErrorAddingMultiValueQueryParameter)

I have two dataset
the first dataset (DS1) will return two value CountryId and CountryName,
the second dataset (DS2) will use the first dataset's CountryId as parameter, this allow multiple values.

this is my DS2 query:
select PracticeId , PracticeName
from PracticeDim
where CountryId in (select cast(regexp_split_to_table(?,',') as int))

I post this query to pg_admin and this is workable as below,
select PracticeId , PracticeName
from PracticeDim
where CountryId in (select cast(regexp_split_to_table('1,2,3,4,5,6',',') as int))

Please help

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,915 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 44,311 Reputation points
    2021-06-01T06:32:55.64+00:00

    multi value query parameter .... select cast(regexp_split_to_table('1,2,3,4,5,6',',') as int))

    That may works directly as a PostgreSQL query with one fix string.
    But if you have a multi-value parameter of type numeric in SSRS report, it sends the selected values as a comma separated list, not as one string.
    So no need to use a split function, use directly in parameter for the IN compare, like

    ... where CountryId in (@yourParameter)
    

  2. Joyzhao-MSFT 15,576 Reputation points
    2021-06-01T06:55:11.727+00:00

    Hi @Tu YuHsuan
    Try the following query for DS2:

    select PracticeId , PracticeName  
    from PracticeDim  
    where PracticeDim.CountryId in (@CountryId)  
    

    In the Report Data pane, expand the Parameters node, right-click the report parameter that was automatically created for the dataset parameter, and then click Parameter Properties.

    In the General tab, select Allow multiple values to allow a user to select more than one value for the parameter.

    (Optionally) In the Available values tab, specify a list of available values to display to the user.

    For more information,please refer to: To add a multi-value parameter
    Best Regards,
    Joy


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.