Skip to Content
0
Sep 18, 2014 at 04:08 PM

Providing values to formulas from vb.net

107 Views

I'm developing my first report (developed with Report Designer) to be fired from vb.net. I'm running into a problem providing a value to a formula from VB code. The report was running correctly before I tried to supply the formula value from VB.

The report contains a formula called ShopSuppliesAmount that looks like this at design time:

0

The a report footer section contains the following suppress condition:

{@ShopSuppliesAmount}=0;

The VB code that fires the report looks like this (I'm including code that provides a stored procedure property value, just in case that has anything to do with the problem):

Dim crParameterField As New ParameterField

Dim crParameterFields As New ParameterFields

Dim crParameterDiscreteValue As New ParameterDiscreteValue


Dim lrptInvoice As New rptInvoice


lrptInvoice.DataDefinition.FormulaFields("ShopSuppliesAmount").Text = Chr(39) & mdecShopSuppliesAmount & Chr(39)

(Note that the variable mdecShopSuppliesAmount is Decimal, and I'm testing with a value of 0.)

crParameterField.Name = "@RepairOrderNumber"

crParameterDiscreteValue.Value = miRepairOrderNumber

crParameterField.CurrentValues.Add(crParameterDiscreteValue)

crParameterFields.Add(crParameterField)

crvReport.ParameterFieldInfo = crParameterFields

crvReport.ReportSource = lrptInvoice

When I fire the report, I'm getting the following error:

A string is required here.

Details: errorKind

Error in File temp_(etc...).rpt

Error in formula Section_Visibility:

'{ShopSuppliesAmount}=0;'

A string is required here.

Details: errorKind

Can someone tell me what I'm doing wrong? Thanks!