Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Function Library (UFL) - Use of objects? 1

Status
Not open for further replies.

eatwork

Technical User
May 16, 2005
155
0
0
CA
Hi,
I am really new to crystal reports and am recreating my access reports as crystal reports. My access reports utilize a few functions and I have created a UFL project to duplicate the functionality. While creating the UFL, I ran into the problem of not being able to see the additional functions I created when I use objects as parameter types. Does anyone know why this might be? and if I could get some suggestions on maybe how to change the code to support this problem? Need to use objects because the database will containt null or blank values. thank you.
Code:
    Public Function formatDimensions(ByVal comActLength As Object, ByVal comActWidth As Object, ByVal comActHeight As Object, ByVal isMetric As Boolean) As String Implements IExchangeUfl.formatDimensions
        Dim str As String
        str = ""
        If Not (CType(comActWidth, Double) = 0 Or comActWidth = "") Then
            If (CType(comActLength, Double) = 0 Or comActLength = "" Or IsNothing(comActLength)) Or _
            (CType(comActHeight, Double) = 0 Or comActHeight = "" Or IsNothing(comActHeight)) Then
                If (isMetric = True) Then
                    str = String.Concat(str, FormatNumber(comActWidth, 2), "Diameter x")
                Else
                    str = String.Concat(str, ConvertMetricToImperial(comActWidth, False), "Diameter x")
                End If

                str = String.Concat(str, IIf(IsNothing(formatLength(comActLength, isMetric)) = True Or formatLength(comActLength, isMetric) = "", "", String.Concat(formatLength(comActLength, isMetric), ("L"))))
                str = String.Concat(str, IIf(IsNothing(formatHeight(comActHeight, isMetric)) = True Or formatHeight(comActHeight, isMetric) = "", "", String.Concat(formatHeight(comActHeight, isMetric), ("H"))))
            Else
                str = String.Concat(str, IIf(IsNothing(formatLength(comActLength, isMetric)) = True Or formatLength(comActLength, isMetric) = "", "", String.Concat(formatLength(comActLength, isMetric), (" x"))))
                str = String.Concat(str, IIf(IsNothing(formatWidth(comActWidth, isMetric)) = True Or formatWidth(comActWidth, isMetric) = "", "", String.Concat(formatWidth(comActWidth, isMetric), (" x"))))
                str = String.Concat(str, IIf(IsNothing(formatHeight(comActHeight, isMetric)) = True Or formatHeight(comActHeight, isMetric) = "", "", String.Concat(formatHeight(comActHeight, isMetric))))
            End If
        End If
        Return str
    End Function
 
You can't use objects as arguments to UFL calls.

You tried to explain why you must use objects, but the explanation is not clear (at least to me).

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Thank you for your post IdoMillet
The reason why I am using object calls is because the data from the database could be null or "" value or dbnull value? I guess the object would allow me to pass null values and handle them within the method itself. Any ideas?
 
I still don't understand the explanation. How is "" or Null value related to the need to pass an object as an argument?

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Hi IdoMillet,
sorry for the confusion, I would like to use the type "object" because it is the only variable type that allows the method paramater to accept both "" and NULL values. I could use a string variable, but the string parameter will not accept my NULL value being passed in. Not sure how else to explain it. Thank you for your post. hope that makes a little more sense?
 
Just "code" this argument in the Crystal formula so a Null gets transferred as "uflNull" for example. Then, in your external function implementation, "decode" it.

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top