! GUIDE_02.SCRIPT - GUIDE Script #2: Customer title 'GUIDE - Sorting' ! Written by Bob van Keuren ! Date 23 Jan 1989 ! Revised 10 Aug 1989 ! ! This script covers SORT and WITH TOTALS. script 'GUIDE' data 'guide !' do clear area box: 9, 33, 14, 77 print at 10, 35: 'In the second tutorial, you will learn how'; print at 11, 35: 'to print records sorted in any order you'; print at 12, 35: 'choose, and to print amounts with totals.'; delay print at 10, 35: 'GUIDE can sort records in any order '; print at 11, 35: 'you choose. For example, if you have '; print at 12, 35: 'a customer file, you can print a list '; print at 13, 35: 'of customers in alphabetical order. '; delay ! clear area box: 9, 33, 14, 77 print at 10, 35: 'To print a customer list, first open '; print at 11, 35: 'the customer file. Enter ' print reverse: "open customer"; print at 12, 35: 'to open it. '; print at 13, 35: ' '; input at 21, 1, prompt 'Guide> ' allow 'open customer,EXIT', & help 'Enter "open customer"': z$ select case z$ case 'EXIT' data 'exit' exit do case 'open customer' gosub customer case 'OPEN CUSTOMER' gosub customer end select end do stop ! CUSTOMER report customer: data 'open customer' clear area box 9, 33, 14, 77 print at 10, 35: 'GUIDE can sort in ascending or descending'; print at 11, 35: 'order. You can sort on any field or'; print at 12, 35: 'group of fields. The SORT command tells'; print at 13, 35: 'GUIDE how to sort.' delay ! clear area box 9, 33, 14, 77 print at 10, 35: 'This report will sort by state, and then '; print at 11, 35: 'by customer name. Enter '; print reverse: 'sort by state'; print at 12, 35: 'to indicate the first sort. '; print at 13, 35: ' '; input at 21, 1, prompt 'Guide> ', allow 'sort by state' clear area box 9, 33, 14, 77 print at 10, 35: 'Within each state, sort by customer' print at 11, 35: 'name. Enter '; print reverse: 'sort by name'; print ' to sort on'; print at 12, 35: 'the name.' input at 21, 1, prompt 'Guide> ', allow 'sort by name' clear area box 9, 33, 14, 77 print at 10, 35: 'After sorting, indicate the fields' print at 11, 35: 'to print. Enter '; print reverse: 'print state,name' print at 12, 35: 'to print the state and customer name.' input at 21, 1, prompt 'Guide> ', & allow '"print state,name", "print state, name"' clear area box 9, 33, 14, 77 print at 10, 35: 'The report will also have the customer'; print at 11, 35: 'number. Enter '; print reverse: 'print custnbr'; print ' to print'; print at 12, 35: 'the number.'; input at 21, 1, prompt 'Guide> ', allow 'print custnbr' clear area box 9, 33, 14, 77 print at 10, 35: 'Finally, the report will print the '; print at 11, 35: 'customer balance, with a total at the' print at 12, 35: 'end. Enter '; print reverse: 'print balance with totals'; print '.' print at 13, 35: '(The word "with" is optional.)' input at 21, 1, prompt 'Guide> ', & allow 'print balance with totals,print balance totals' clear area box 9, 33, 14, 77 print at 10, 35: 'You have set up all the fields.' print at 11, 35: 'Enter '; print reverse: 'go'; print ' to produce the report.' input at 21, 1, prompt 'Guide> ', allow 'go,EXIT': z$ select case z$ case 'EXIT' data 'exit' return case 'go' data 'go' case 'GO' data 'go' end select clear area 18, 1, 21, 80 clear area box 7, 33, 11, 76 print at 8, 35: 'GUIDE asks where to print the report.' print at 9, 35: 'Enter '; print reverse: 'scr'; print ' to print the report at the' print at 10, 35: 'terminal.' input menu '%title " Output Options ", %at 18, 8, %items 2, "Screen"=SCR, "Printer Port"=pri, "System Printer"=sys, "Save to Disk"=sav, exit', allow 'scr' keyboard print at 19, 1: ''; clear area 18, 1, 21, 80 clear area box 7, 33, 11, 76 print at 8, 35: 'After printing, GUIDE returns to the'; print at 9, 35: 'print option menu. Enter'; print at 9, 61, reverse: 'exit'; print ' to'; print at 10, 35: 'return to GUIDE.'; input menu '%title " Output Options ", %at 18, 8, %items 2, "Screen"=SCR, "Printer Port"=pri, "System Printer"=sys, "Save to Disk"=sav, exit', allow 'exit' clear area box 9, 33, 14, 76 print at 10, 35: 'GUIDE prints the report format again.' delay print at 10, 35: 'In this exercise, you learned how to '; print at 11, 35: 'sort records with the SORT command '; print at 12, 35: 'and to print totals using WITH TOTALS.'; print at 13, 35: 'Now type '; print reverse: 'exit'; print ' to exit from GUIDE. ' input at 21, 1, prompt 'Guide> ', allow 'EXIT' return end script