How use IN operator on SqlDataSource

2 posts, 0 answers
  1. Fernando
    Fernando avatar
    66 posts
    Member since:
    Sep 2012

    Posted 20 May 2016 Link to this post

    Hi guys,

    I am using Telerik Reporting R2 2016 and I need to create a query in a SqlDataSource which has a IN operator that should use an parameter. For sample, I have list of IDs (Supplier Id) that will be passed into the report and I need to apply it using the IN operator on the dataSource. How can I do it on Telerik Report?

    I tried to configure a query on the SqlDataSource like this:

    select s.* from suppliers s where s.Id in (:Ids)

    And after that I tried to run by Telerik Report Design and keep the :Ids parameter as string, int32 or object does not work. I fiil up the parameter like 1,2,3 (separated by comma) but I get an Oracle exception saying it is not a valid number. How can I define a string parameter on the report and pass it to the report?

    (i will use it on a mvc using the javascript/html5 telerik reporting viewer).

    Thank you.
  2. Stef
    Stef avatar
    3610 posts

    Posted 25 May 2016 Link to this post

    Hi Fernando,

    The :Ids SQL parameter must be mapped to a multivalue report parameter. This is step 4 of the SqlDataSource Wizard. As a design-time value to get the data schema you can pass a single value (step 5).

    Further details about how to configure the SQL query and report parameters are discussed in the How pass multivalues param values to report MVC or HTML5? forum thread.

    I hope this information is helpful.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top