Reports for WinForms

Calculated Field Syntax

  •  none00 said 9 months, 3 weeks ago:

    I have a field setup as Calculated and want to do the following:

    If database field "OpenItem" is true, display the text "Open>" otherwise display nothing
    The following script does accomplish this successfully:
    iif (openitem=true,"Open >","")

    Now, I also want to add value of database field "Amount" to a control named OpenTotal when "OpenItem" is true
    Tried the following but no success:

    iif (openitem=true,"Open >","")
    if openitem=true then OpenTotalCtl=OpenTotalCtl + amount

    What’s the proper syntax to accomplish this?

    Also, I have a label on a report with text "Current Balance" how do i insert a line break between Current and Balance so it displays as:
    Current
    Balance

    Hope someone can help today.
    Thanks,

    Lee

  •  none00 said 9 months, 3 weeks ago:

    I was able to add the following code to the Detail Section OnFormat to make it work:

    If openitem = true Then
    openflag="Open>"
    opentotal=opentotal+amount
    Else
    openflag= ""
    Endif

    Now, that caused another problem.

    In my Group Header OnFormat I initialize OpenTotal=0 That works fine but, if group goes onto next page, another group heading appears and resets OpenTotal again. Other than removing Repeat from Group header, how do I get around this problem?

  •  Mohita24p said 9 months, 2 weeks ago:

    Hello,

    1. In order to display 'Current Balance’ as
    Current
    Balance
    you can either :
    a. set the same at design time by setting the value of the width just enough to hold the text 'Current’. This will push the text 'Balance’ to next line. Also, make sure to set it’s 'CanGrow’ property to 'True’
    or
    b. you may add the rtf text with line break and set the Field’s 'RTF’ property to 'True’

    2. Instead of initializing OpenTotal=0 in the Group Header’s OnFormat, you may use the GroupFooter’s OnFormat. Since, the GroupFooter will be called only at the end of each group (if it’s repeat property is set to False), there won’t be any re-setting of the value if the group splits among pages.

    And the first initialization of the OpenTotal can be done in the Report’s OnFormat.

    Hoe it helps!

    Let us know if you require any further assistance.

    Regards,
    Mohita

    Answer
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.