home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / database / informix / 2400 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  3.1 KB

  1. Path: sparky!uunet!ogicse!emory!emory!not-for-mail
  2. From: jerry@jerry.mendota.ingr.com (Jerry Jugovich)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: defer interupt
  5. Message-ID: <1dtv7nINN5ra@emory.mathcs.emory.edu>
  6. Date: 12 Nov 92 06:03:03 GMT
  7. Article-I.D.: emory.1dtv7nINN5ra
  8. Sender: walt@mathcs.emory.edu
  9. Reply-To: jerry@jerry.mendota.ingr.com (Jerry Jugovich)
  10. Distribution: world
  11. Organization: Mailing List Gateway
  12. Lines: 105
  13. NNTP-Posting-Host: emory.mathcs.emory.edu
  14. X-Informix-List-ID: <list.1592>
  15.  
  16.  
  17.                                 Nov 12 92
  18.  
  19. Here is how I handle interupting screen reports by testing a variable in
  20. the page trailer section of the report. I had the need to interupt long 
  21. screen reports.
  22.  
  23. What I found was depending on the type of report by this a mean a single
  24. pass report or a 2 pass report the placement of the call to c_waitcr()
  25. was critical. If the report was a 2 pass report. By the way if you use
  26. group by statements this is a 2 pass report. And the call also has to be 
  27. placed in the group by clauses. 
  28.  
  29. function a_report_function()
  30.  
  31.     declare rep_cur cursor for select * from foo
  32.  
  33.     foreach rep_cur into rep_var.*        # global variable like foo #
  34.  
  35.           if rpt_c = 1 then
  36.                   let rpt_c = 0
  37.                exit foreach
  38.         end if
  39.  
  40.         output to report my_report ( rep_var.name ) # step into report #
  41.  
  42.     end foreach
  43.  
  44.         finish report my_report                         # step into report finish #
  45.  
  46. end function
  47.  
  48. report my_report ( in_group )        # report using global variables  #
  49.                     # that were selected by a cursor #
  50.  
  51.                                         # must define variable even if passed # 
  52.                                         # a global variable ugh....           #
  53.  
  54. define in_group like foo_table.foo_column     
  55.  
  56. output
  57. page length 22
  58. left margin 0
  59. right margin 132
  60. top margin 0
  61. bottom margin 0
  62.  
  63. format
  64.  
  65. page header
  66.         print column 45,"THIS IS A PAGE HEADER",column 112,today
  67.  
  68. on every row
  69.  
  70.         print column 5, "* ", global_var CLIPPED
  71.  
  72. page trailer
  73.     if rpt_c = 1 then 
  74.         return 
  75.     else
  76.         call c_waitcr()
  77.     end if
  78.  
  79.     clear screen
  80.     display ""
  81.  
  82. before group of in_group
  83.     if rpt_c = 1 then 
  84.         return 
  85.     else
  86.         skip to top of page
  87.     end if
  88.  
  89. end report
  90.  
  91. #     Function used to process all screen interupts #
  92.  
  93. function c_waitcr( )
  94.     define
  95.         rrwait  char( 1 )
  96.  
  97.     prompt "Press q to quit, any other key to continue.  "attribute(cyan)
  98.  
  99.            for char rrwait
  100.                if ( rrwait matches "[qQ]" ) then
  101.                    let rpt_c = 1
  102.                    clear screen
  103.                    return
  104.                end if
  105.  
  106.            clear screen
  107.            let rpt_c = 0
  108.            return
  109. end function
  110.  
  111.  
  112. I used the debuger to follow a report. This is what worked for me.
  113.  
  114.  
  115. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  116.  Mail Path: jerry@jerry.mendota.ingr.com        Jerry Jugovich
  117.  Phone:     612 681-4450                        TIM Application Engineer
  118.                                                 Intergraph Corporation
  119.                                                 Mendota Heights Minnesota
  120. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  121.