You can accomplish having all the checkboxes selected by default in two ways. The first way is to pass an object array of values, and the easiest way to do that is to use the Split command to split a string into a string array. I used =Split(“M,N,I”,”,”) as my default. I had to provide the second parameter for Split, the delimiter, because the default is space.
The second, and easier method, is to just add a line item for each item you want checked, as demonstrated in this screenshot:
Here is the resulting parameter list, showing all the items selected (same for either method):
Sometimes, you need to display the parameters of your report, perhaps so it could be regenerated later. You’ll need to print out that object array, so use the opposite of Split, Join. Below is a textbox with an expression of =Join(Parameters!Time.Label, “, “), which joins the parameter values together with a comma and space separator.
Here is the result of the code, with two parameters selected shown:
If you only put the parameter label in the textbox (i.e. using code =Parameters!Time.Label) then when you display the report, you’ll get the famous Reporting Services #Error message. You have to use Join in this case.
Option 2:
Create function below and add this to code section in the report properties. After adding, you can call the function inside the report.
Code:
Public Function JoinTrim(myArray as object) As String
Dim ReturnString as string, Item as string, FirstItem as boolean = true
ReturnString = ""
For each Item in myArray
If FirstItem = True
ReturnString = Trim(item)
Else
ReturnString = ReturnString + ", " + Trim(item)
End If
FirstItem = False
Next item
Return ReturnString
End Function
Sample expression using the join function:
=Code.JoinTrim(Parameters!parmsample.Label)