This is a migrated thread and some comments may be shown as answers.

ReportParameters in bindings

1 Answer 63 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 2
Joel asked on 21 Jul 2011, 05:43 PM
Is is possible to access ReportParameters in bindings?  I am trying to avoid adding a column to my dataset with a single value, but am having some difficulties.

I have a function
    Public Shared Function GetStarValue(ByVal _Metric As Double, ByVal _ValType As Int32) As String
        If _ValType = -1 Then 
            Return "*"
        Else
            Return CStr(FormatNumber(_Metric, 1))
        End If
    End Function

Called via a binding for a textbox works fine:
=GetStarValue(cdbl(Fields.MyScore), -1)

this does not
=GetStarValue(cdbl(Fields.MyScore), cint(ReportParameters(1).Value))

debug Textbox on the page populated with the following correctly shows -1 so the value is available:
 TextBox5.Value = ReportParameters(1).Value

Error is:
An error has occurred while processing TextBox 'TextBox1':
The expression contains undefined function call ReportParameters().

Is it possible to access parameters in this way, if not, any alternatives other than adding 1000 rows of "-1" to my dataset?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 22 Jul 2011, 08:40 AM
Hi Joel,

As duly noted in our documentation (see Using Report Parameters in Expressions), report parameters are referenced with the keyword =Parameters e.g. =Parameters.VendorSelect.Value.
Indexing is not supported in expressions but would work if you use parameters programmatically.

Generally whenever you need a predefined column with either constant value or some expression, use Calculated Fields.

Regards,
Steve
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
General Discussions
Asked by
Joel
Top achievements
Rank 2
Answers by
Steve
Telerik team
Share this question
or