cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a customized summary for a group

Former Member
0 Kudos

I'm trying to create a customized summary for a group.  Instead of doing something like summing records in a group, I'd like to concatenate records in a group that satisfy a given condition.  (If this is too complicate, I could first create a formula that executes the condition by recording the value if the condition is met and "" if it isn't.)  I figure I need a loop to execute this but I can't seem to figure out how to tell the formula to proceed to the next record in the group.  Please look at my code below:

Local stringVar MetersWithGaps := "";
Local numberVar i := 1;
Local numberVar LastMeter := maximum ({METERREAD.SEQUENCE_NUMBER});

for i := 1 to LastMeter step 1 do
(
    if {@Gap} >= {?Gap Parameter} then MetersWithGaps :=  MetersWithGaps + {METERREAD.METER_NUMBER} + ", ";
);
MetersWithGaps

Basically, I want to look at the time gap between reading each meter in a route (from sequence number one to max).  If the gap (@Gap is a formula that calculates the gap for each meter) is greater than the specified duration (?Gap Parameter), please concatenate the meter number to a string called MetersWithGaps.

For the below example, given ?Gap Parameter = 1.5 minutes, you should get:

RouteMetersWithGaps
AA2, A3
BB2

RouteMeterGap
AA11
AA22
AA32
BB11
BB22
BB31

Please help me figure out the error in my formula.  Thanks, Lynne

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi Lynne,

1) I hope you have a Group on the Route field

2) Place the @Gap formula on the Details Section

3) Create this formula and place it on the Details Section as well:

whileprintingrecords;

stringVar MetersWithGaps;

if {@Gap} >= {?Gap Parameter} then

     MetersWithGaps :=  MetersWithGaps + {METERREAD.METER_NUMBER} + ", ";

4) Create this formula and place it on the Group header:

whileprintingrecords;

stringVar MetersWithGaps := "";

5) Another formula on the Group Footer to Display the final Meters:

whileprintingrecords;

stringVar MetersWithGaps;

Left(MetersWithGaps, len(MetersWithGaps)-2);

-Abhilash

Answers (0)