[quoted text, click to view] Jonas Montonen wrote:
> Lev Semenets [MSFT] wrote:
>
>> JFYI, parameters can be accessed by name, i.e.
>> =Parameters("Param1").Value (same as =Parameters!Param1.Value)
>> Or even =Parameters(Field!A.Value).Value
>>
> Yes, that we know.
>
> What I want is to be able to (programmatically) loop all parameter and
> there values, appending them to a tring and display that string in the
> report.
>
> So if I add a parameters, I will not have to update the logic for
> displaying the parameter values.
>
> Regards Jonas Montonen
As a workaround I'm trying another funtion in the Code section.
But I would like to have a identical function in each report... so some
parameter could be missing.
Is there a way of refering/checking if a parameter exists and not get
the error ??
Eg:
IF(not Report.Parameters("PARAM_THAT_ARE_MISSING") is nothing) then
.
.
End if
This line generates this error today :(
"The value expression for the textbox ‘textbox2’ contains an error: The
expression referenced a non-existing parameter in the report parameters
collection."
FYI:
- Textbox2.Value: "=Code.getParametersHeader()"
- PARAM_THAT_ARE_MISSING is a parmeter that is not present in the actual
report (Dummy to trigger this error)
// Regards Jonas Montonen
Function getParametersHeader()
Dim retString
Dim parCount
Dim newLine
Dim ParamsPerLine
ParamsPerLine = 3
parCount = 0
If(Report.Parameters("Pop").Label <> "") then
parCount = parCount +1
newLine = getParamNewLine(parCount, ParamsPerLine)
retString = retString + newLine + "Pop: " +
Report.Parameters("Pop").Label
end if
if(Report.Parameters("Measure").Label <> "") then
parCount = parCount +1
newLine = getParamNewLine(parCount, ParamsPerLine)
retString = retString + newLine + "Pop: " +
Report.Parameters("Pop").Label
end if
if(Report.Parameters("TimeType").Label <> "") then
parCount = parCount +1
newLine = getParamNewLine(parCount, ParamsPerLine)
retString = retString + newLine + "Time Type: " +
Report.Parameters("TimeType").Label
end if
if(not Report.Parameters("PARAM_THAT_ARE_MISSING") is nothing) then
parCount = parCount +1
newLine = getParamNewLine(parCount, ParamsPerLine)
retString = retString + newLine + "PARAM_THAT_ARE_MISSING: " +
Report.Parameters("PARAM_THAT_ARE_MISSING").Label
end if
Return retString