Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Calculation to replace summary info? (newbie help)


This topic is 8469 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

FM newbie needs help ;-)

I need to generate and print out a deposit report which lists contribution info (contributor name and contribution amount). Currently, the layout is set up to list this info and a summary field reports the total deposit amount. When the records spill over to a new page, the same total contribution amount is reported on each page, rather than page totals.

Now, I need to limit the number of records to 25 per page and then have each page totaled individually. I imagine I'll need to use a calculation to achieve this but have no clue where to begin...any help will be greatly appreciated - thanks!

  • 1 month later...
Posted

Sting -

Don't know if this will help, but here's one solution.

First, you will have to play around with your layout to make sure that 25 records appear in your list on each page, with room at the bottom for your subsummary part (tell it to make a page break after each occurrence). Adjust your layout to make it come out right for your printer definition.

Now, the fun part.

You can use the status function CurrentRecordNumber to group your records into sets of 25. By giving every record in the first set of 25 the number "1", you can then get a summary total for those records, which, if you've done your layout correctly, can appear at the bottom of the page in a sub-summary part of the layout.

To make the "Record Set" field, try this:

If(

Mod(Status(CurrentRecordNumber),25)=0,

Truncate(Status(CurrentRecordNumber)/25,0),

Truncate(Status(CurrentRecordNumber)/25,0)+1

)

[No, it's not elegant, but it's 5 a.m. here and I'm tired. I'm sure you can come up with a better calculation.]

This says the following:

If the remainder of the current record number divided by 25 is 0 (i.e. it's a multiple of 25), then take that exact multiple.

If it isn't, then take the truncated answer to the division problem and add 1 to it.

Therefore, the first 25 records will have the Record Set value "1". Records 26 through 50 will have the Record Set value "2", etc.

Create a second field, "ContributionTotal" that is a summary to total up your contribution records. This is "total" of "contribution" (which is a number).

In your layout, now create a subsummary part after the body and have it work when sorted by "Record Set".

In this part you will put a third field called "Set Total," which is a calculation that uses the getsum function, not a summary. It looks like this:

GetSummary(ContributionTotal, Record Set)

The getsummary function acts like a summary field, in this case a summary of contribution summarized by the group Record Set, but you can put it anywhere on your layout, including in the body or elsewhere. Getsummary functions are also useful because they can be part of other calculations.

Now, return to your layout and put "Set Total" into your sub-summary part.

Now to the endgame. First, sort your records as you wish to have them. Don't know if this is by date or by contributor, or both. The Status(CurrentRecordNumber) functions should update itself when you do this, which means that your "Record Set" field should also update. To make sure this is working properly, put the "Record Set" field in the body of your layout. You should see that the first 25 records all say 1, etc.

Now sort your list again, but this time putting "Record Set" at the top of the sort list. Leave your other sort fields in place, but below Record Set.

Now when you preview the page, you should find that you have a summary total for each page.

If you put your summary field CongtributionTotal at the end in a trailing grand summary part, you'll also get the grand total for all pages.

There are always other ways of doing things. I hope this helps.

By the way, Status Functions can be really useful, but they are also unpredictable, don't update all the time, etc. When using them be sure to test the behavior of any calculations/values based on status functions to make sure that your use of them is predictable. If you don't like using the Status function in this solution, you could always create a number field and then have that field serialized (replace serial) before you run your report. This will "hard number" your records in serial fashion.

Charlie

This topic is 8469 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.