We are in need of a visualization of all parameters (about 16 of them)
 for our reports. (When a cutstomer prints a report, we need to have the
 parameters (mostly filterering input) values available)
 Is there a way if "looping" the Parameters Collection, creating a String
 or populate a table with the parameter/value pairs?
 We tried to create a string by looping the Report.Parameters object in
 the "Code" section, but it is not a collection so we failed there.
 Also tried to access the parameters "by index". Looping until we fails,
 but it seems you cant access the paremeters by index :(
 The solution we have is to create a table with a field for each
 parameter. But this is a non dynamic and non generic solution. A bit of
 worl work too for our 25+ reports with about 10-15 parameters each.
 Anyone out there have a solution for this problem?
 Regards
 Jonas MontonenJFYI, parameters can be accessed by name, i.e.
=Parameters("Param1").Value (same as =Parameters!Param1.Value)
Or even =Parameters(Field!A.Value).Value
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jonas Montonen" <jonas.montonen@.ascade.se> wrote in message
news:OMW23aBwEHA.2012@.TK2MSFTNGP15.phx.gbl...
> We are in need of a visualization of all parameters (about 16 of them) for
> our reports. (When a cutstomer prints a report, we need to have the
> parameters (mostly filterering input) values available)
> Is there a way if "looping" the Parameters Collection, creating a String
> or populate a table with the parameter/value pairs?
> We tried to create a string by looping the Report.Parameters object in the
> "Code" section, but it is not a collection so we failed there.
> Also tried to access the parameters "by index". Looping until we fails,
> but it seems you cant access the paremeters by index :(
> The solution we have is to create a table with a field for each parameter.
> But this is a non dynamic and non generic solution. A bit of worl work too
> for our 25+ reports with about 10-15 parameters each.
> Anyone out there have a solution for this problem?
> Regards
> Jonas Montonen|||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|||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
End Function|||Jonas Montonen wrote:
> We are in need of a visualization of all parameters (about 16 of them)
> for our reports. (When a cutstomer prints a report, we need to have the
> parameters (mostly filterering input) values available)
> Is there a way if "looping" the Parameters Collection, creating a String
> or populate a table with the parameter/value pairs?
> We tried to create a string by looping the Report.Parameters object in
> the "Code" section, but it is not a collection so we failed there.
> Also tried to access the parameters "by index". Looping until we fails,
> but it seems you cant access the paremeters by index :(
> The solution we have is to create a table with a field for each
> parameter. But this is a non dynamic and non generic solution. A bit of
> worl work too for our 25+ reports with about 10-15 parameters each.
> Anyone out there have a solution for this problem?
> Regards
> Jonas Montonen
Not very nice... there must be a better way.
Usage:
TextFieldXX.Value "=Code.getParametersHeader(5, "Pop,AgreementType,
ServiceLevel, CRAZY_PARAM_THAT_DOES_NOT_EXIST")
Function getParametersHeader(paramsPerRow, daWantedParams)
 Dim myArray() As String = Split(daWantedParams, ",")
 Dim RetVal As String
 Dim newLine As String
 Dim parCount As Integer
 Dim paramsPerLine
 ON ERROR RESUME NEXT
 For Each curParam As String In myArray ' Iterate through elements.
 If(Report.Parameters(curParam.ToString()).Label <> "") then
 newLine = getParamNewLine(parCount, paramsPerRow)
 RetVal += newLine + curParam.ToString() + ": " +
Report.Parameters(curParam.ToString()).Label
 parCount += 1
 end if
 Next
 Return RetVal
End Function
Function getParamNewLine(countValue, valuesPerRow)
 if((countValue mod valuesPerRow) = 0) then
 return vbcrlf
 else
 if((countValue mod valuesPerRow) = 1) then
 return " "
 else
 return " | "
 end if
 end if
End Function|||I'm afraid that is not supported. But I think it is possible to do
indirectly, using custom assemly.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Jonas Montonen" <jonas.montonen@.ascade.se> wrote in message
news:%236H$b9LwEHA.1396@.tk2msftngp13.phx.gbl...
> 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
> End Functionsql
No comments:
Post a Comment