Help: I4GL/C reports firing AFTER GROUP OF triggers erroneously
Posted in 1999
Topics: Storage & Space Management, SQL Development & Query Writing, Connectivity: ESQL/C, 4GL & Embedded SQL, Triggers, Constraints & Referential Integrity
I4GL/C version 6.04.UC1 on SCO I have a fairly simple report (so far) I am developing. It is actually the core of a more complex system in case you wondered at the strange code. The data varies in how many of the "t" columns are actually used for ordering. The rest are constant, as you can see from the output. It seems to fire the BEFORE GROUP OF triggers correctly but then fires all the AFTER ones too. I have looked through the release notes and can see no clues. I have tried renaming variables, reordering the trigger statements and reducing the number of them. As expected, these have had no effect. Other reports I have work fine, although none exercise the feature to this extent. Am I missing something obvious? Has anyone else experienced this problem? Any help or clues would be gratefully received. Peter The report code, sorry it's a bit long: ----------------------------- -- %W% table main 4GL report function define nstruc smallint -- load module variables function start_report() let nstruc = get_nstruc() end function report tabreport(summary_type, data, t1, t2, t3, t4, t5, t6, t7, t8) define summary_type char(1), data smallfloat, t1 smallint, t2 smallint, t3 smallint, t4 smallint, t5 smallint, t6 smallint, t7 smallint, t8 smallint output top margin 0 bottom margin 0 left margin 0 page length 3 -- not used but must be > header + footer order external by t1, t2, t3, t4, t5, t6, t7, t8 format first page header print "s __data _t1 _t2 _t3 _t4 _t5 _t6 _t7 _t8" before group of t1 if (nstruc >= 1) then print "before group of t1" end if before group of t2 if (nstruc >= 2) then print " before group of t2" end if before group of t3 if (nstruc >= 3) then print " before group of t3" end if before group of t4 if (nstruc >= 4) then print " before group of t4" end if before group of t5 if (nstruc >= 5) then print " before group of t5" end if before group of t6 if (nstruc >= 6) then print " before group of t6" end if before group of t7 if (nstruc >= 7) then print " before group of t7" end if before group of t8 if (nstruc >= 8) then print " before group of t8" end if on every row print summary_type, data using " ---&.&", t1 using " --&", t2 using " --&", t3 using " --&", t4 using " --&", t5 using " --&", t6 using " --&", t7 using " --&", t8 using " --&" after group of t8 if (nstruc >= 8) then print " after group of t8" end if after group of t7 if (nstruc >= 7) then print " after group of t7" end if after group of t6 if (nstruc >= 6) then print " after group of t6" end if after group of t5 if (nstruc >= 5) then print " after group of t5" end if after group of t4 if (nstruc >= 4) then print " after group of t4" end if after group of t3 if (nstruc >= 3) then print " after group of t3" end if after group of t2 if (nstruc >= 2) then print " after group of t2" end if after group of t1 if (nstruc >= 1) then print "after group of t1" end if on last row print "End of report" -- skip 1 line end report ----------------------------- Small sample off the top of the output file: ----------------------------- s __data _t1 _t2 _t3 _t4 _t5 _t6 _t7 _t8 before group of t1 before group of t2 before group of t3 before group of t4 before group of t5 M -1.0 1 -1 -1 8 1 -1 -1 -1 after group of t5 after group of t4 after group of t3 after group of t2 after group of t1 before group of t5 M -1.0 1 -1 -1 8 2 -1 -1 -1 after group of t5 after group of t4 -- SHOULD NOT BE PRINTED after group of t3 -- SHOULD NOT BE PRINTED after group of t2 -- SHOULD NOT BE PRINTED after group of t1 -- SHOULD NOT BE PRINTED before group of t5 M -1.0 1 -1 -1 8 3 -1 -1 -1 after group of t5 after group of t4 -- SHOULD NOT BE PRINTED after group of t3 -- SHOULD NOT BE PRINTED after group of t2 -- SHOULD NOT BE PRINTED after group of t1 -- SHOULD NOT BE PRINTED ... etc ... <it does this consistently to the bottom of the file> ----------------------------- -- Peter Lancashire Information Systems Specialist, Bayer plc Eastern Way, Bury St Edmunds, Suffolk, IP32 7AH, UK Tel: +44-1635-562258, Fax: +44-1635-562281 -- If all else fails, read the instructions and the release notes. Join Infuse, the UK Informix User Group at http://www.infuse.org.uk/
Peter Lancashire wrote: > > I4GL/C version 6.04.UC1 on SCO > > I have a fairly simple report (so far) I am developing. It is actually > the core of a more complex system in case you wondered at the strange > code. The data varies in how many of the "t" columns are actually used > for ordering. The rest are constant, as you can see from the output. > > It seems to fire the BEFORE GROUP OF triggers correctly but then fires > all the AFTER ones too. Right the AFTER GROUP OF triggers for all lower ordered groups are triggered when any higher order group changes. The solution is to protect the print statements in each section with an IF block testing on a global var or argument var that indicates if each print level is needed. Art S. Kagel