Re: ORDER BY within REPORT routine
Posted in 1998
Ian Clark wrote: > > Hi All, > > When writing reports within 4GL programs I usually end up with my > usual SELECT...FOREACH...OUTPUT TO REPORT scenario. > > The ordering is usually done with the initial SELECT statement. > > What I would like to know is in what circumstances should I consider > using the ORDER BY statement within the REPORT routine? Would the > report be produced any quicker, is it more efficient and is it any > easier? > > Any views/comments would be very welcome. > > Cheers, Ian. If you output a second report within your program, either you need to pull the data again (same query, different ORDER BY) or reformat the data (same cursor, ORDER BY in report function). Case in point . . I have a DBA-type report program that creates two reports as output. Since I pull all necessary data with my initial select, I use the ORDER BY on the select to order the data for my first report. If I run the second report in the program, I use the ORDER BY in the report function. I only access the database once. John Carlson Informix DBA WH Smith, Inc.