Problem
I need to generate a report usage LOG with the user, report name, date of use, and selected parameters. Most of the fields were obtained using the Built-In Faithful . However, I can not get a string with all report parameters ( name and value ).
It is possible to produce this string with concatenation expressions, but it is not very feasible in my case. I need to apply this to all of the organization's reports and concatenate multiple time-consuming fields and attention errors can occur easily. So I'm looking for an automatic way to list all parameters.
Attempts made
- Using the SQL executionlog3 table : The user name that is registered is not correct because of a local server configuration.
- Use some scripts in Custom Code as this : These types of scripts require FullTrust security permissions, which the institution is not willing to give.
- Try to loop in the collection Parameters via Custom Code : This is not allowed - "You can not use Visual Basic for each construct to step through the collection." - Documentation Link
Proposed solution
The least expensive way I could do was to pass the parameter names to a custom code string.
Expression
=Code.PrintParam("param1 param2")
VB function
Public Function PrintParam(ByVal paramslist As String) As String
Dim params = split(paramslist)
Dim final as String = ""
For Each param As String In params
final &= param & " = " & Report.Parameters(param).Value & "; "
Next
return final
End Function
Result:
param1 = 10; param2 = 20;