1
votes

I think an array could solve the problem for summary fields 'by item'...

Source Data:

"Event 1"

"Event 2"

"Event 3"

Multiple instances of these occur different zones (Group1), and different dates (Group2) so on any given day I report out:

Day 1

"Event 1" - 2 occurences

"Event 3" - 3 occurences

Day 2

"Event 1" - 5 occurences

"Event 3" - 7 occurences

Easy enough to total, keep track of by day but now I want to include grand totals for each specific Event Type at end of report. Thinking if I create an array to count each time a record hits for each event, can just spew them out at end of report in cumulative fashion.

EventArray with key "Event 1" increment each time record is "Event 1" EventArray with key "Event 2" increment each time record is "Event 2"

So on and so forth...

Just not sure where to put; how to code...has to be some variation of the below but just not quite sure:

//Build
WhileReadingRecords;
Local StringVar Key := "" & {Customer.EventType};
Local NumberVar Amt := "Count of Event Types";
StringVar array Keys;
NumberVar Array Amts;
if not(Key in Keys) then
( redim preserve Keys [count(Keys)+1];
redim preserve Amts[count(Keys)+1];
Keys[count(Keys)]:= Key;
Amts[count(Keys)]:= Amt );
Amts [1]

In something like perl it's easy enough to do with a hash but not sure how/where to do it in Crystal.

In the end I'd guess the array to look something like:

ArrayName["Event 1"] = 17 or however many times a record had "Event 1" in the field Customer.EventType

ArrayName["Event 2"] = 18 or however many times a record had "Event 2" in the field Customer.EventType

I dunno...

1
Which version of Crystel? Is it Crystal For VS or actual Crystal Reports?campagnolo_1
Actual Crystal Reports Suite.user2917111

1 Answers

0
votes

You could do a very simple solution by just creating separate formulas for each event that would go something like if Customer.EventType = Event1 then 1 else 0. Put them in the appropriate section and suppress. Then add a summary in the appropriate section and total each formula. This will of course be too much work if you have hundreds of events. Then arrays will be the better way to go. Let me know if you need to do array and I will be happy to help you out with that.

Cheers,

Chris