Results 1 to 5 of 5

Thread: Resetting a variable for new group

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    48

    Resetting a variable for new group

    I have a report that simply counts the number of times a field is true.

    This works fine for the first group, but then falls down. The variable continues counting, how do I reset it for every group.

    Here is one of the formula I am using:

    Shared numberVar CountOfAwaitingOutcome;

    If {tbl_Enquiry.AwaitingOutcome} = "Yes" Then
    CountOfAwaitingOutcome := CountOfAwaitingOutcome + 1


    The whole report is grouped by the type of procedure... So for example

    There may be 3 waiting for Botox, and 1 waiting for Hip.

    My reports shows

    Botox 3

    Hip 4

    I want it to show

    Botox 3

    Hip 1

    Can anyone help?

    Many thanks

    Mark

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Resetting a variable for new group

    How does your forumla know when it is finished with a particular group?

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2005
    Posts
    48

    Re: Resetting a variable for new group

    Currently, it doesn't. But I want it to know when the group changes as i need to reset it.

  4. #4
    Addicted Member
    Join Date
    Jan 2001
    Location
    MPLS
    Posts
    187

    Re: Resetting a variable for new group

    Don't actually count with a shared variable on your detail record, create a separate formula say AwaitingOutcome10 with

    If {tbl_Enquiry.AwaitingOutcome} = "Yes" Then 1
    Else 0

    Drop that on the details section. Next insert a summary field ("Sum" calc type) on the AwaitingOutcome10 formula for your Group "Type". Last if so choose insert a summary ("Sum" calc type) on the Report Footer for a grand total count. You can suppress the AwaitingOutcome10 formula in the details section once you confirm the totals are working correct.

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Resetting a variable for new group

    To clear/reset a shared variable you need to create another formula and place it in the section where the variable should be reset.

    Code:
    Shared numberVar CountOfAwaitingOutcome;
    
    CountOfAwaitingOutcome := 0
    In this case, put the formula in the Group Header section and Suppress it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width