You have two more alternatives to passing by parameter, although none of them are very good.
(Beware! After I wrote the next paragraph, I found that the default values ββfrom the queries are not supported in local processing mode, so this first solution may not be suitable for you, because it is not for me.)
You can create a hidden report parameter with the default value set from the data set, and then reference it using the Report.Parameters!MyParam.Value . When testing, you should be careful, because (at least in BI studio 2005) the report parameters do not seem to be reliably reinitialized from the database on the "Preview" tab.
Alternatively, you can create a hidden text field in the report with its text set from the data set, and then refer to the text field from the code. In this case, you should pass the ReportItems object as a parameter, but the slight advantage is that it is only one additional parameter. Be sure to enter the parameter strongly when declaring it:
public Sub MyCustomCode(ri as ReportItems)
The code will work in BI-studio without a type declaration, but for me it caused errors with the help of the report viewer in the local processing mode if there was no " as ReportItems ".
In any case, this is really useful for page-level data, so functions for use in a table should still take parameters.
source share