Report Calculation Question

I have a calculated field that I am attempting to subtotal on (hrs).
The field is calculated for each detail record being printed.

Do I need to do something different since it is not in the record set?
I have my group header and footer set to the correct grouping field but the
sub total field prints zero (depthrs)

I looked at the Xojo example but the field to total is actually in the record
set and not a calculated field.

Suggestions will be appreciated!

Hello Julian,

One possible way to create a subtotal is to perform the math by cycling through the recordset to get the subtotals, and then update the report with the value in the appropriate report field.

Here is some pseudocode:

Dim Xtotal as double xtotal = 0 rs = db.SQLSelect("Select Name, Cost from Library") If rs <>Nil then do until rs.EOF xtotal = xtotal + Cost rs.movenext Loop End if

Then place the value of xtotal at the appropriate place on the report. This may not be exactly what you want, and it helps create a dialogue.

I don’t think the report can perform a calculated field.

Hope this helps :slight_smile:

Thanks. I will give it a try later today.

Eugene,
Thanks for the suggestion but I could not get that to work.
Are there any report writers out there for Xojo you would recommend?
If not I guess I could do it all by hand coding and not use a report control
Thanks again for your help
Julian

Hi Julian,

The standard Xojo Report maker is difficult and suffers from a few issues. Some of the more common Report Editors are:
Valentina Reports
RSReport
BKeeney Shorts

Here is a link which discusses a few of these Report Editors: Forum Discussion on Report Editors

If you are only working on Windows OS, then you can use Microsoft Word. Sorry, Microsoft Word doesn’t work for the Mac.

There are many options, and it may be best to try a few of them out and use the one which is more comfortable for you.

Sincerely,

Eugene

Thanks for the information. This is a learning process for me for sure. I have used Clarion for Windows for so many years that I have to rethink my way of doing things :slight_smile:

dId you ever figure this out? I’m trying to do something similar.