I have a couple of general questions about using VB code with SSRS reports in SharePoint. I have noticed that when I use an expression on my report, the expression only talks to the data that is in the report; which includes what that report is returning, so if I am filtering, the expression will only talk to the filtered data instead of the data set call as a whole. My question is, does creating VB functions behind the report behave the same way because you use an expression to call it, or will it work off of the initial query before any filtering or sorting on the list? How does the VB code interact with the data set? Does it behave differently because I am using a SharePoint list?


1 Answer 1


The thing to consider is the context of where the expression is that calls the code behind function or performs any calculation. If you write an expression in a details table, the expression will be evaluated for each independent row of that dataset as each row is placed in the table. Similarily, if you write the expression in a plain textbox on the report, the expression will be only evaluated once. You cannot simply write a code behind function that just access an entire dataset in your report.

With that in mind, it depends what you are doing as to how you would write a function. In the past I have created multi-value parameters and assigned the default value to be a column in a dataset. I can then call my code behind function in an expression (not in a grouped area, but in an individual textbox) and pass the function my multi-value parameter to do what I wish with that array of values. More often than not though, I want my code behind function to be run for each individual value in a dataset and I place the call inside of a table expression.

Lastly, the datasource won't matter at all once the data is retrieved and the SSRS engine is creating the actual report.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.