Wildcard search in dataset parameters

jmv 21 Reputation points
2020-10-11T20:23:30.523+00:00

I have a standard report that uses a Program name as a dataset paramter in multiple reports. Is there a way, in SSRS, to write and expression that uses a wildcard search.

Right now, the dataset Parameter name is @P.P.U.H. Program .
In Parameter value I am trying to do something like CCPA%.

But I know this would need to be an expression. Can anyone give me any help? I really can't change the underlying query. The issue is I have one report that needs to read a program that has CCPA or CCPAP. I thought a wildcard search would solve this.31379-ssrs.png

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.
0 comments No comments
{count} votes

Answer accepted by question author
  1. ZoeHui-MSFT 41,536 Reputation points
    2020-10-14T06:04:18.843+00:00

    Hi @jmv ,thanks for your reply.However I couldn't fully understand your meaning. Do you mean that you couldn't modify the dataset query?

    I tried another way to add a filter but I'm not sure if it meet your needs. Below is the steps.

    We already have the parameter @P.P.U.H. Program .

    And then add a filter to the dataset.

    Expression:=IIF(InStr(Fields!program.Value,Parameters!program.Value) OR Parameters!program.Value = "*", TRUE, FALSE)

    Setting like this
    32216-screenshot-2020-10-14-135658.jpg

    I set the parameter @P.P.U.H. Program default value to "*" so the report will grab everything by default.

    If this way doesn't meet your requirement, you may describe your needs with more details. Or do you mean that you just want to add an expression value to the parameter to do the wildcard search?

    Regards,

    Zoe


    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.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. ZoeHui-MSFT 41,536 Reputation points
    2020-10-12T02:10:55.577+00:00

    Hi @jmv ,

    You can concatenate a wildcard charater in your query for the parameter:

    where Program like ('%' + @P.P.U.H. Program + '%')

    And then you may enter CCPA% for search.

    Here is my test.
    31435-screenshot-2020-10-12-100954.jpg
    31429-screenshot-2020-10-12-100759.jpg

    Regards,

    Zoe


    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.


  2. jmv 21 Reputation points
    2020-10-13T15:26:58.27+00:00

    Thank you so much for your detailed reply. I really appreciate that. There are some instances where a wildcard search wouldn't be good for all the @Programs. Is there a way to write a single expression for just this report in particular? I may have mentioned, I use this single query to run multiple reports. Again, your input is greatly appreciated.

    0 comments No comments

Your answer

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