Re: output section
Posted in 1994
>From: london@drawbax.attmail.com >Date: 24 Jan 94 21:38:21 GMT >To: informix-list@rmy.emory.edu >Subject: output section > >Fellow sqler's and 4gler's, > >If this is a trivial question forgive me but.... > >Is there a way to "variablize" the report to statement so a user can input >the destination, in either 4gl or ace reports. So far the only solution I >was given was to have separate reports for separate destinations all >hardcoded in the reports. This makes for many of the same reports all >going to different printers or files. I'd like to cut down on duplicate >reports. I have many. > >Thanks in advance > >Brian London > >J.M. Rodgers Co., Inc. >245 Woodport Road >Sparta, NJ 07871 >(201) 729-6700 /* "You got the right key baby but the wrong >attmail!drawbax!london /* keyhole", Steven Tyler, Aerosmith Well, what about: CALL report_destination("report_name") RETURNING rep_dest, rep_name CASE WHEN rep_dest = 0 START REPORT report_name WHEN rep_dest = 1 START REPORT report_name TO PRINTER WHEN rep_dest = 2 START REPORT report_name TO rep_name WHEN rep_dest = 3 START REPORT report_name TO PIPE rep_name OTHERWISE ???? END CASE All reports get written to go to default (screen) destination. The report_destination() routine can get remarkably fancy if required -- it could use the report name argument to determine which printers are suitable, use the user id to determine which printers to send the report to, fib like fury (user requests screen output, but report requires 132 column output, so send the report to a pipe which resets the terminal in 132 column mode on entry and back to 80 column mode on exit), and all sorts of other startling variations. I've used variations on this theme for ages with considerable success. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>