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 best solutions below
Related Questions in C#
- Passing arguments to main in C using Eclipse
- kernel module does not print packet info
- error C2016 (C requires that a struct or union has at least one member) and structs typedefs
- Drawing with ncurses, sockets and fork
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- Configured TTL for A record(s) backing CNAME records
- Allocating memory for pointers inside structures in functions
- Finding articulation point of undirected graph by DFS
- C first fgets() is being skipped while the second runs
- C std library don't appear to be linked in object file
- gcc static library compilation
- How to do a case-insensitive string comparison?
- C programming: Create and write 2D array of files as function
- How to read a file then store to array and then print?
- Function timeouts in C and thread
Related Questions in VB.NET
- If...Then...Else Visual Basic 2012
- Detecting whether a mouse button is down in vb.net
- IOrderedEnumerable to vb.net IOrderedEnumerable Conversion
- vb.net Get PrivateMemorySize64 and process id sort by memory size
- Cannot insert values into database
- check validation of an expression with Regex
- VB.NET KeyNotFoundException from String()
- How do i display data that are in between 2 values in a DDL?
- VB.net: How to make original variable value fulfill 2 statements?
- Login form by using a new database, made in VB
- Get Text from listbox in VB.net
- error handing for uploading large size file
- XML Null Element Visual Basic
- Using chart and tooltip
- vb2010 Express - Operator '=' is not defined
Related Questions in REPORTING-SERVICES
- Pass multiple account variables to single parameter
- Update SSRS security for reports
- SSRS Report Expression, for 2 fields in one column
- How to assign dataset values in RDLC report header?
- SSRS Multi-Value Parameter Not Filtering
- Toggle groups based on a parameter
- How to build rptproj using C#
- Don't produce report if there is no data - PDF
- SSRS ListRenderingExtension Unauthorised Exception
- SSRS Color Expression Lesser than X
- Format Numbers in Multiple columns of SSRS Report
- Create Sum of calculated columns in Microsoft Reporting Services like Fibonacci series
- SSRS parameter Datatypes
- creating many reports from a single template - what is this called?
- SSRS Add Parent Group to Entire Tablix
Related Questions in CUSTOM-CODE
- Formatting particular text within SSRS
- Facebook sharing window - how do i edit?
- App42 Custom Code Instantiating Mechanism
- Error while trying to deploy App42 Custom-Code
- Color Swatches in Launch theme
- There is an error on line 58 of custom code: [BC30201] Expression expected
- Generating a glidepath in power BI
- Accessing Parameter Collection in SSRS Custom Code to get Parameter Name/Value Pairs
- Bot Framework .dialog file and CodeAction
- How should I move my code from dev to production?
- SSRS expression editor does not recognize embedded code function
- When I export the PDF the custom code is not recognized
- How to add a button to all posts in wordpress?
- How can I edit Elementor Textbox with automatic date?
- The (custom module's) custom multi product tabs not showing on the product page in magento2 backend admin
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)
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?

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.