2
Problem
I need to generate a report usage log with the user, report name, usage date and selected parameters. Most of the fields were obtained using the Built-In Fiels. However, I cannot 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 organization reports and concatenating multiple fields takes time and attention errors can occur easily. So I look for an automatic way to list all parameters.
Attempts made
- Use SQL executionlog3 table : the user name that is registered is not correct because of a local server configuration.
- Use some scripts in Custom Code such as this : These types of scripts require Fulltrust security permissions, which the institution is unwilling to give.
- Try to loop Collection Parameters via Custom Code : This is not allowed - "You cannot use a Visual Basic For Each Construct to step through the Collection." - Documentation link
Proposed solution
The least expensive way I could do was passing the parameter names by a string to custom code.
Expression
=Code.PrintParam("param1 param2")
Function VB
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
Upshot:
param1 = 10; param2 = 20;