Wednesday 15 May 2013

Using SSRS report to pass in a param value the is a csv list to SQL Dataset -


I created an SSR report that contains a text field parameter where users will enter a list of comma separated values ​​of commas. That list will be fed into the dataset of the report in the SQL query, which has one ... ... WHERE the field in (@ MISCPParam).

If I pass the same value from the ground, it works, but if I pass the CSV list from the field then the report says that such a value is not present.

I think it is treating the CSV list as a value and therefore no data is returned.

How can I convert that CSV list and convert it to the ultimate usable for SQL in the filter?

"post-text" itemprop = "text">

I was searching for a way to do this today, and there are so many suggestions in it to create a stored procedure to handle it But I got this solution a bit of a mess I finally came up with my own, really simple solution.

So, you can say that you want the user to be able to enter more than one sales order in a text box, separated by commas such as: 61JF073, 61SW073, 61SW074

My first report parameter has been named "Order No", Description "Order Number (Separated from Comma)". Data type = "text", and nothing is checked.

My second parameter is taking the list from the first parameter and creating a "multiple pricing" list that you will be able to use in your SQL query.

The second parameter: name = "command" ", type =" text "." Allow multiple values ​​"is checked parameter visibility =" internal "(user does not need to see it) Add the value of available value = no default value = value = value: = partition (change (parameter! OrderNo.Value, "", ""), ",")

I am using a "Change" function to delete all the spaces because user commas After that, you can enter the blank space that will affect the output.

Now the result in your SQL query "

SELECT OrderNo, SalesID, SalesName FROM SalesOrders where there is no order (@order node)

The data will be filtered in SSRR instead of SSRS, which is the most preferred way to protect the entire table from reloading before filtering the SSRS report. You only want to retrieve the data needed for reporting.

I hope this is helpful because it was a life experience for me because there are several thousand rows in my sales order table.

No comments:

Post a Comment