# Using automatic break

Hello everybody,

I have a doubt about automatic break. I started in a new job few months ago and at this position firstly I’m training in natural development.
To getting a new employees report with details like job function, company, ID, etc…ordered by ID, I got a problem. I need insert some breaks when the crescent ID numbers reach some values. What is the best way to do these breaks?. For example:

Company --------- ID

`````` X -------------------- 00100
X -------------------- 00200
X -------------------- 00300
``````

Employee number with ID lower than 500: 3 <--------- BREAK

`````` X -------------------- 00650
X -------------------- 00700
X -------------------- 00810
X -------------------- 00910
X -------------------- 01001
``````

Employee number with ID grater then 500: 5 <--------- BREAK
Total X company employees: 8

Company --------- ID

`````` Y -------------------- 00010
Y -------------------- 00020
Y -------------------- 00025
``````

Employee number with ID lower than 30: 3 <--------- BREAK

`````` Y -------------------- 00031
Y -------------------- 00035
Y -------------------- 00042
Y -------------------- 00051
``````

Employee number with ID grater then 30: 4 <--------- BREAK
Total Y company employees: 7

Total employees: 15

Thanks,

you may be able to use the AT BREAK to do what you want - set an additional variable based on the break criteria, sort the data appropriately, then use the AT BREAK to display COUNT(brker) and additional AT BREAK, AT END paragraphs to display higher totals.

Hi Douglas,

How will the additional variable based on the break criteria work? And how will its relation with COUNT be?

Thanks for help,

I am guessing, but it seems like you will probably have a table of “break values”. Such tables have a way of changing (usually when you want to go away on vacation).

Trying to set up a separate value could be messy. (Hi Doug, long time no see).

I would suggest (if my “guess” is correct) that you start the application by reading in the appropriate table of break points into an array. Then, as you read each record, execute code to ascertain whether a break has occurred or not.

steve

C

Thanks all,

It’s almost working. I used an additional variable and the command with COUNT function to guide the breaks; all this is inside the READ function. But the break is one line after it would have to stay. Look it:

Company --------- ID --------- Additional variable

X -------------------- 00100 ----- A
X -------------------- 00200 ----- A
X -------------------- 00300 ----- A <— The BREAK must be after this line
X -------------------- 00650 ----- B

Employee number with ID lower than 500: 3 <--------- actual BREAK

X -------------------- 00700 ----- B
X -------------------- 00810 ----- B
X -------------------- 00910 ----- B
X -------------------- 01001 ----- B
.
.
.
.
.

How can I resolve this situation?

Thanks,

During break processing, both the old and new field values are available to you. Verify that you are displaying the “old” values, using the System Function OLD. Wilfried gave an example of this in the code sample in his earlier posting.