SQL Server Performance

Function call giving an error

Discussion in 'SQL Server 2005 Reporting Services' started by vdeepacssrs, Mar 8, 2007.

  1. vdeepacssrs New Member

    Hello all,

    This is the Function:

    Public Dim GrossValue As double = 0.00

    Public Function GetGrossValue(ByVal dPymt as Double,ByVal dFlag as Boolean) As Double
    If(dFlag = False) Then
    GrossValue = GrossValue + dPymt
    Return GrossValue
    Else
    Return 0.00
    End If
    End Function

    Public Function ResetValue()
    GrossValue = 0.00
    End Function


    I am calling this function in a textbox

    =IIF(Fields!IsEarnCancelled.Value,
    Nothing,
    (Code.GetGrossValue(Fields!Gross.Value,Fields!IsEarnCancelled.Value)))

    I DO NOT KNOW where I am doing wrong. But it is giving me "The Value expression for the textbox ''textbox200" contains an error: Input string was not in correct format.

    Please help




    Thanks,
    Deepak
  2. ranjitjain New Member

    Hi,
    I'm not familiar with RS but I know some VB and based on your error, i can make a wild guess.

    consider this:
    IIF(Fields!IsEarnCancelled.Value,
    Nothing,
    (Code.GetGrossValue(Fields!Gross.Value,Fields!IsEarnCancelled.Value)))

    replace it with
    IIF(Fields!IsEarnCancelled.Value,
    Nothing,(Code.GetGrossValue(VAL(Fields!Gross.Value),FALSE)))

    Here I replaced Fields!IsEarnCancelled.Value with FALSE because this part will be called only when IIF finds the value other than TRUE.
    If it runs correctly, then you can even remove passing boolean flag which I think not required then.
  3. vdeepacssrs New Member


    Thanks Ranjith for the response.

    I have replaced my code with the code that you sent accross, but it is still giving an error. The result's are showing perfectly fine in both the cases but it is showing Warning Message like this "The Value expression for the textbox textbox200" contains an error: Input string was not in correct format."



    Thanks,
    Deepak

Share This Page