I have an SSRS report requirement to generate json string through custom code by concatenating all the report Parameter name and value pairs. To achieve this I can explicitly access each report parameters and concatenate to generate the expected text. But , I am trying to find if there is anyway to loop through the parameter collection and generate it dynamically , so that there is no need to update the function whenever a new parameter is added. Thank you!!
Accessing Parameter Collection in SSRS Custom Code to get Parameter Name/Value Pairs
1.2k views Asked by rosh At
1
There are 1 answers
Related Questions in C#
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in VB.NET
- how do i stop system stack overflow in visual basic?
- Finding and Using Camera found in “Imaging Devices” in VB.NET
- Finding a specific colour within a bitmap range - VB.net 2022
- Filtering a double value
- How to call late bound extension method from VB.NET (Framework)
- Accessing a variable from a string
- Calling ToString with a nominated format returns Char rather than String
- Monthly attendance report in Crystal Report
- Progress Bar increment while running
- GetValue for Field contains too many arguments
- Icon of Window form application
- vb.net connection string to a regular google drive
- VB.NET how to check if a form already exists?
- How to get paste to work for pasting in text in a textbox?
- How to convert base64 string to image using vb.net
Related Questions in REPORTING-SERVICES
- SSRS cannot aggregate a variable
- How to filter data in a report using Microsoft Report Builder based on Orders of Service (OS) dates?
- Check if a value is not in a list in SSRS
- SSRS Report Builder returns error when entering more than one value in a parameter filter
- SSRS - Do not want to round a percent
- SSRS report exporting as PPT file
- SSRS use a dynamic SQL query with parameter
- Error when trying to change subscription owner (SSRS, SQL Server 2016)
- Background Colour Conditional Formatting in PBI Report Builder
- do you know any free reporting services like devexpress or boldreports?
- Embedded SSRS permissions error using rsweb:ReportViewer
- SSRS - Visual Studio round issue
- How to Implement Multi-Parameter Queries in SSRS Report Builder with Databricks ODBC?
- I want to integrate Crystal reports or SSRS reports in react js
- Column Grouping in SSRS report Matrix
Related Questions in CUSTOM-CODE
- Webflow development: How to integrate (global) custom JS code for best performance?
- Need animation repeat on scrolling from Bottom to top with Wow Library in GHL
- Custom dynamic widgets with FlutterFlow
- Generating a glidepath in power BI
- How to add custom javscript feature in a UI Form Builder?
- FlutterFlow: Cupertino Datepicker
- Can you create a custom dimension in GTM and send it to GA4 with custom code? Without having to manually create it inside GA4
- Add a custom sort by location on wordpress
- Wordpress pagination in gallery
- Custom code to set a value for User Agent (i.e. operating system)
- Get latest post from a specific author - genesis wordpress
- Get all posts by specific author - wordpress
- Custom policy does not maintain previous values on properties array
- How to add a button to all posts in wordpress?
- Adding colours to WooCommerce Stock Status
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)

OK, so due to the fact that the parameters collection is not very well supported via custom code, this will only work once the report is deplyed to the server. This makes it tricky to debug but we can work around that by hardcoding a parameter whilst we test.
This answer might look long but in fact it's pretty quick to do.
To get started Create a report and add your parameters
In my sample report I had two parameters,
Deploy the report now even though it's not finished we need to deploy now for the rest to work.
So the first things we need to do is get a list of parameters. We can do this if we know the report's full path. We will hardcode this value for now but make it dynamic before we finish.
Create a dataset called
dsParametersand set the query to the following.This will return someting like
Now right-click the dataset, choose "dataset properties" then "Parameters".
Set the
@ReportPathparameter value to the path and report name of your report. You can get thisReportServer.dbo.catalogin thePathcolumn, it will look something like="/Sales Reports Folder/My Sales Report". Note the forward slashes.We will come back to the hardcoded value later once it's all working.
Next, go to the report's properties and click the Code tab.
Paste in the following two functions.
The first function accepts a parameter object and data type and loops thru the parameter values to return a single line such as
"CountryID":["89","94"]The second function takes the parameters collection and a list of parameter names and types in the form
Name1|Type1,Name2|Type1. It starts with the json "header", repeatdly calls the first function adding comma's as required and then closes the json.The output will be something like this...
NOTE I have only defined quoting for the
Stringtype, you may need to adjust to suit your needs.Finally (almost) create a textbox and set the value expression to
Here's the final report output...
FINALLY We need to make that dataset parameter dynamic. Go back to the dataset's parameters and set the
@ReportPathparameter value toThat's it.