! GUIDE_7.SCRIPT - Script #7: Multiple structures title 'GUIDE - Multiple structures' ! Written by Bob van Keuren ! Date 20 Apr 1989 ! Revised 11 Aug 1989 ! ! This script covers RELATE, SHOW OPEN. script 'GUIDE' data 'guide !' do clear area box: 8, 32, 14, 76 print at 9, 34: 'A report can use more than one data' print at 10, 34: 'structure. You can name the data ' print at 11, 34: 'structures in OPEN commands, and then' print at 12, 34: 'specify how you are going to use them' print at 13, 34: 'with RELATE commands.'; delay clear area box: 8, 32, 14, 76 print at 9, 34: 'In this report, you will print invoices,' print at 10, 34: 'using the DETAIL and INVOICE structures.' print at 11, 34: 'Enter '; print reverse: "open detail"; print ' to open the DETAIL'; print at 12,34: 'file.' input at 21,1, prompt 'Guide> ' allow 'open detail,EXIT', & help 'Enter "open detail"': z$ if z$ = 'EXIT' then data 'exit' exit do end if data 'open detail' gosub detail end do stop ! Report on INVOICE and DETAIL ! detail: clear area box 8, 32, 14, 77 print at 9, 34: 'Next, open the INVOICE structure.'; print at 10, 34: 'Enter '; print reverse: 'open invoice'; print ' to name the second'; print at 11, 34: 'structure.'; input at 21, 1 prompt 'Guide> ', allow 'open invoice' clear area box 8, 32, 14, 77 print at 9, 34: 'The report will print information from' print at 10, 34: 'the invoice for each detail line it prints.' print at 11, 34: 'You can tell GUIDE to look up the invoice' print at 12, 34: 'with a RELATE statement. Enter '; print at 13, 34: reverse: 'relate detail(invnbr) to invoice(invnbr)'; print '.' input at 21, 1, prompt 'Guide> ', & allow 'relate detail(invnbr) to invoice(invnbr)' clear area 8, 32, 14, 80 clear area box 8, 33, 13, 77 print at 9, 35: 'The SHOW OPEN command displays a list' print at 10, 35: 'of the structures you have opened.' print at 11, 35: 'Enter '; print reverse: 'show open'; print ' to see the list.' input at 21, 1 prompt 'Guide> ', allow 'show open' clear area box 8, 33, 13, 77 print at 9, 35: 'Now select a group of the records in' print at 10, 35: 'DETAIL. Enter '; print at 11, 35, reverse: "include detail(invnbr) < 10315"; print '.'; input at 21,1 prompt 'Guide> ', allow "include detail(invnbr) < 10315" clear area 8, 77, 13, 77 clear area box 8, 33, 13, 76 print at 9,35: 'The report will do a level break' print at 10,35: 'on invoice number. Enter' print at 11,35, reverse: 'break on detail(invnbr)'; print ' for this level' print at 12, 35: 'break on the number.' input at 21,1 prompt 'Guide> ', allow 'break on detail(invnbr)' clear area box 8, 33, 13, 76 print at 9, 35: 'Print the invoice number only when' print at 10, 35: 'it changes. Enter '; print at 11, 35, reverse: "print detail(invnbr) group 1"; print '.'; input at 21, 1 prompt 'Guide> ', allow 'print detail(invnbr) group 1' clear area box 8,33,14,76 print at 9,35: 'Now print the invoice date. This field' print at 10,35: 'is in the INVOICE structure, not the'; print at 11, 35: 'DETAIL file, so you need to name the' print at 12, 35: 'structure with the field. Enter: '; print at 13, 35, reverse: 'print invoice(date) group 1' input at 21,1 prompt 'Guide> ', allow 'print invoice(date) group 1' clear area 14,33,14,76 clear area box 8,33,13,76 print at 9,35: 'Enter '; print reverse: 'print itemnbr,qty'; print ' to print the'; print at 10,35: 'line item and quantity.'; input at 21,1 prompt 'Guide> ', & allow '"print itemnbr,qty","print itemnbr, qty"' clear area box 8,33,13,76 print at 9,35: 'You can format the selling price with'; print at 10,35: 'the MASK option. Enter'; print at 11,35, reverse: "print price mask '###,###.##'"; print at 12,35: 'to print the price in this format.' input at 21,1, prompt 'Guide> ', allow "print price mask '###,###.##'" clear area 8, 33, 8, 80 clear area box 9, 33, 14, 76 print at 10,35: 'Finally, print the extended price with' print at 11,35: 'totals and subtotals. Enter'; print at 12,35, reverse: 'print extprice totals'; print '.' input at 21,1, prompt 'Guide> ', & allow 'print extprice with totals,print extprice totals' clear area 12,33,14,80 clear area box 9,33,12,76 print at 10,35: 'For a title, enter: '; print at 11,35: reverse: "title 'Invoice Listing'"; input at 21,1, prompt 'Guide> ', allow "title 'Invoice Listing'" clear area box 9, 33, 13, 77 print at 10, 35: 'You have set up all the fields.' print at 11, 35: 'To see the commands you have entered,'; print at 12, 35: 'type '; print reverse: 'show commands'; print '.'; input at 21, 1, prompt 'Guide> ', allow 'show commands' clear area 9, 33, 13, 80 clear area box 9,33,12,76 print at 10,35: 'The report format is complete.'; 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' delay data '' delay data '' delay data '' delay data '' delay data '' delay data '' delay data '' 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 at 10, 35: 'to 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 10, 33, 15, 77 print at 11, 35: 'In this script, you have learned how'; print at 12, 35: 'to use multiple structures with the'; print at 13, 35: 'commands RELATE and SHOW OPEN.'; delay clear area box 10, 33, 15, 77 print at 11, 35: 'Now enter the command '; print reverse: 'exit' print ' to exit'; print at 12, 35: 'from GUIDE.' input at 21, 1, prompt 'Guide> ', allow 'EXIT' return end script