Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grand Totals

Status
Not open for further replies.

synapsevampire

Programmer
Mar 23, 2002
20,180
US
How would you sum on a field and get the different field values as a grand total (outside of any grouping) when the fields are dynamic?

i.e.,

Group 1 header: Region
Group 2 header: MyCodes
Detail {MyFieldToSum}
Group 2 header: Region
Group 1 header: MyCodes

<Descriptions and Grand Totals of each Mycodes type here>

I can get a grand total for this field, or the subtotals for this field at a group level, but how would I get the grand totals for each of the My Codes types at the report Footer level? I can't hard code conditional variables for each Mycodes because they're dynamic.

What I'm trying to do is avoid subreports, and display the data which comprises a grand total graph which is based on this.

If it can graph it...

Thoughts?

-k kai@informeddatadecisions.com
 
I am not sure that I follow, but can't you use a cross-tab?
That allows you to recap your groups dynamically at the end of the report. Do you mean the FIELDS are dynamic or the field VALUES are dynamic? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
The field data is dynamic, and the format requires that I not use a cross tab.

The field MyCodes is dynamic, I may have 3 one week, or 100 the next week.

So at the end of the report, where I have a summary graph showing these MyCodes and their grand totals (which is easily done in a graph), I would like a summary of the codes, and their values (the values are being converted to a HH:MM:SS format, one for grand total, and one which is a simple mean average.

A cross-tab would be fine for a sum of values, or a simple mean average, but I need specific formatting.

Thans for any thoughts, I fear this might require a sub-report, which 'd hoped ot avoid.

-k kai@informeddatadecisions.com
 
First, could you explain why the formatting precludes cross-tabs? I am pretty sure you are correct, there are lots of ways to use cross-tabs.

You could also build an array (or several) on the way through the report, and then display this array at the end in whatever layout you need. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
The formatting will be as follows:

The GT sum of the seconds, and the GT mean average of the seconds, will be diplayed in a HH:MM:SS format, as in:

Type Duration Avg
MyCodes 1 01:23:56 00:12:23
MyCodes2 12:34:56 01:09:34

My duration is in seconds, I don't see a means to display the sum of these as HH:MM:SS in a cross tab.

I did a proof of concept with creating arrays to keep track of the Types, Duration, and Avg, but maintenance of these scared my client. And then you have the multiple variables with the 255 char issue, formatting the output consistently, etc... I also feared that the *hit* in building and maintaining these arrays might exceed the *hit* from the additional SQL (subreport).

So you've addressed this the only way I could think of, perhaps there's some trick for formating output in a cross tab that will allow me to forego a subreport?

Thanks again for the response.

-k kai@informeddatadecisions.com
 
You are correct (as I suspected). That layout won't fit a cross-tab.

The performance comparison depends on how much time the SQL takes, vs how many records will be in memory to be processed through the array. The 255 shouldn't be an issues, since each element can be subscripted when output. It is the output (or result) that has the limitation. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Thanks again for the thoughts.

What does &quot;The 255 shouldn't be an issues, since each element can be subscripted when output&quot; mean?

In order to output them, I'll have to loop through the array(s), which means using a string, right? Perhaps you're thinking that I have a group by which I might index these when output, but I don't because the output is in the report footer.

Do you have another means?

-k kai@informeddatadecisions.com
 
I meant you could write several formulas to display the array in chunks. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
<nodding>

Which is what I meant by &quot;And then you have the multiple variables with the 255 char issue&quot;

Thanks for your thoughts, I had hoped someone might have tackled this before and found some elegant solution.

Did I say elegant and Crystal in the same sentence?

The most annoying thing about this is that you can get these values into a graph with just a few clicks...

-k kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top