1 / 20

This presentation includes custom animations. To view the animations, you must view the presentation in Slide Show mod

This presentation includes custom animations. To view the animations, you must view the presentation in Slide Show mode and activeX controls must be allowed. If you have opened this lesson in PowerPoint, use the PowerPoint menus to view it in slide show mode.

norton
Download Presentation

This presentation includes custom animations. To view the animations, you must view the presentation in Slide Show mod

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. This presentation includes custom animations. To view the animations, you must view the presentation in Slide Show mode and activeX controls must be allowed. If you have opened this lesson in PowerPoint, use the PowerPoint menus to view it in slide show mode. If you have opened this lesson in a browser and see a bar similar to that below, click on the Slide Show icon A notice similar to the one below may appear warning that ActiveX or other scripts are disabled. Enable the controls for this website in order to see the animations.

  2. The Control Break Algorithm This slide show discusses a famous algorithm for generating reports. Vocabulary: control break detail footer grand total header level subtotal summary Christine S. Wolfe Ohio University Lancaster 2008-Aug-01

  3. The report shown below is a type that is commonly found in business. It lists a set of records that are grouped together based on some common value. At the end of each group, subtotals are displayed and a grand total appears at the end. This type of report is called a “control break” report. Click Tip Control break reports are named that way because the report takes a little “break” in the processing every time the value in the “control” field changes.

  4. The data below represents the text file that contains the data for the report. If we only needed a grand total, the solution would be easy. It would be a simple loop like the ones we’ve used to calculate totals and find highest and lowest values. SalesmanID Amount Total 8 1090.00 1000 100.00 1000 200.00 3000 210.00 1000 50.00 2000 300.00 3000 150.00 1000 30.00 3000 50.00

  5. Click through the algorithm to calculate the total amount sold. 1000 100.00 1000 200.00 3000 210.00 1000 50.00 2000 300.00 3000 150.00 1000 30.00 3000 50.00 SalesmanID 3000 1000 1000 3000 Amount 200.00 100.00 50.00 210.00 NumSales 1 0 3 8 2 100.00 300.00 0 510.00 1090.00 TotalSales

  6. The previous example did not produce subtotals for each sales person. To calculate subtotals, the input file must first be sorted on the control field. SalesmanID Amount Salesman Num Total 1000 4 380.00 2000 1 300.00 3000 3 410.00 Total 8 1090.00 1000 100.00 1000 200.00 1000 30.00 1000 50.00 2000 300.00 3000 150.00 3000 50.00 3000 210.00

  7. This is the algorithm seen on slide 5 that was used to calculate the grand total.

  8. The steps outlined in blue must be added to the algorithm to process the control break.

  9. Key to solving a control break problem is to save the value of the control field into a holding variable so that each new record can be compared to the holding value in order to determine whether or not the control value has changed. Variables must also be declared and initialized to hold the subtotals.

  10. The subtotal variables are updated at the same time and in the same way as the grand totals.

  11. As each record is read, the value in the control field is compared to the holding value. If they are different it means that it is time to end one group and start another group. 3 steps make up the control break processing: The contents of the holding variables and subtotal variables are printed. The holding variable(s) are reset to the new value. The subtotal variables are reset to zero.

  12. After the last record is processed, the subtotals for the last group are displayed.

  13. This is another control break report. Click to see the parts of the report.

  14. REPORT HEADER GROUP HEADER DETAIL LINE GROUP FOOTER GROUP HEADER DETAIL LINE GROUP FOOTER GROUP HEADER DETAIL LINE GROUP FOOTER GROUP HEADER DETAIL LINE GROUP FOOTER REPORT FOOTER

  15. A group is a set of records that have the same value in one of their fields. This is the only information that is read directly from the file. report header (before reads) group info (before read) description details 1 / record This is the layout of a single level control break. (You can tell it is a single level because there is only one level of grouping.) group info (after read) Sub-Totals group info (before read) description details 1 / record group info (after read) Sub-Totals report footer (after reads) Grand Totals

  16. report header group header group header details details details group footer group header details This is the layout of a 2-level control break. (You can tell it is a 2-level because there are 2 levels of grouping.) details group footer group footer group header group header details details group footer group header details details group footer group footer report footer

  17. report header Ohio header Cincinnati header household household household Cincinnatifooter Columbus header household household Columbus footer Ohio footer Pennsylvania header Philadelphia header household household Phildelphia footer Pittsburgh header household household Pittsburgh footer Pennsylvania footer report footer

  18. report header Ohio header Cincinnati header household household household Cincinnatifooter Columbus header household household Columbus footer Ohio footer Pennsylvania header Philadelphia header household household Phildelphia footer Pittsburgh header household household Pittsburgh footer Pennsylvania footer report footer Cramer household Philadelphia PA 4 Cole household Cincinnati OH 2 Cole household Cincinnati OH 2 Wimer household Cincinnati OH 5 Fichter household Pittsburgh PA 3 Scherer household Columbus OH 3 Oktela household Pittsburgh PA 4 Zang household Columbus OH 1 Scherer household Columbus OH 3 Cramer household Philadelphia PA 4 Smith household Philadelphia PA 4 Smith household Philadelphia PA 4 Wimer household Cincinnati OH 5 Fichter household Pittsburgh PA 3 Zang household Columbus OH 1 Oktela household Pittsburgh PA 4

  19. Output Input • ID $ Amt • 1000 100.00 • 1000 200.00 • 1000 30.00 • 1000 50.00 • ---------------------- • 1000 4 380.00 • 2000 300.00 • ---------------------- • 2000 1 300.00 • 3000 150.00 • 3000 50.00 • 3000 210.00 • ---------------------- • 3000 3 410.00 • ========================= • Total 8 1090.00 1000 100.00 1000 200.00 1000 30.00 1000 50.00 2000 300.00 3000 150.00 3000 50.00 3000 210.00

  20. Report header (Title, Columns) Salesman Header (none) Sale (SalesmanID, Amount) Salesman Footer (NumByID, SalesByID) Report footer (NumSales, TotalSales) • ID $ Amt • 1000 100.00 • 1000 200.00 • 1000 30.00 • 1000 50.00 • ---------------------- • 1000 4 380.00 • 2000 300.00 • ---------------------- • 2000 1 300.00 • 3000 150.00 • 3000 50.00 • 3000 210.00 • ---------------------- • 3000 3 410.00 • ========================= • Total 8 1090.00 1000 100.00 1000 200.00 1000 30.00 1000 50.00 2000 300.00 3000 150.00 3000 50.00 3000 210.00

More Related