Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Averages in Report Builder

Post Reply
danielf
Posts: 44
Joined: Tue Jul 26, 2011 2:48 pm

Averages in Report Builder

Unread post by danielf »

Hi,

I'm working on a report that uses a listbox (as in invoice list on sample debtors). As in the invoice list example I use the listbox to select a number of categories and create a data table with a join for all records for a specific category. I then want to print some summary statistics for the combined records that belong to every category. This sort of works the way I want in that I can get aggregate sums for the fields within a column. However, I need to compute averages, and it looks like the report builder will only compute sums?

I played around with the invoice list report, and if I include a field AVG(tra_total) on the page footer it remains blank, even though SUM(tra_total) happily sums the total for all transactions.

In my own report I can retrieve the total sum and the number of items I need to compute an average over, but if I include a field sum(amount) / sum(count) I get an error message.

Is there any way to display an average within the report builder, or do I need to do this within the PHP code? If the latter, how do I do that when working with a listbox? The idea is that the listbox will allow me to select the categories over which I want to group the records. Then I want to compute averages for every category. Thus, in terms of the invoice list example, I'd want to be able to print all invoices or transactions for the customer(s) selected, and then compute (for instance) the average amount per invoice for each customer.

Cheers,

Dan
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Averages in Report Builder

Unread post by admin »

Dan,

There is a function you can use called percent(), this should do what you want..

http://wiki.nubuilder.com/tiki-index.ph ... eld_Object

Steven
danielf
Posts: 44
Joined: Tue Jul 26, 2011 2:48 pm

Re: Averages in Report Builder

Unread post by danielf »

Thanks Steven,

That indeed does do what I want. I did check the wiki. Not sure why I missed that one...

On a side note: I noticed that there's a statement to increase allocated memory size in some of the reports. I presume it's wise to include this by default? It made me wonder though if there's anything I should be aware of in terms of Nubuilder's default memory allocation and the size of data bases it can deal with? It's not as if I'm expecting crazy amounts of data, but I'd like to know if there are any limits I should be aware of.

Thanks,

Dan
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Averages in Report Builder

Unread post by admin »

Dan,

If you're printing reports hundreds of pages long you might have a problem.

Otherwise database size won't matter with nuBuilder.

Steven
Post Reply