[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Portrait or Landscape from an IF statement



On Mon, Apr 23, 2001 at 10:42:42AM -0500, Benzenhafer, Dave wrote:
> After looking at the SQR archives, I gather that SQR will not support a
> change in printing format based on an IF statement.
> I am trying to confirm this won't work before I spend three days on it.
> Example
>
>    If $p_mfg_rpt = 'Y'
>       Use-report land
>    Else
>       Use-report port
>    End-if

I'm not sure what the context was for the messages you found, but I
think the code above should allow you to do what you want, with the
following notes:
 a) you can't switch orientation in the middle of a report (i.e.
    remember that when you use USE-REPORT, you are moving the output
    to a separate report file)
 b) you will need to have separate DECLARE-REPORTs for the two kinds of
    report, each configuring the proper page layout
 c) you will need to be careful about the filenames that the output
    files will receive.  Because you will have separate DECLARE-REPORTs
    for "land" and "port", they will be given separate file names.
    If you just choose one or the other of the reports and all the
    output goes to the same place, only one file will be created --
    but if the report you are using is the second one defined, it the
    file will be called "reportname_01.spf" instead of "reportname.spf".


If you do know at report compile time which orientation you want to use
(i.e. you can pass the info in on the command line), then you can use
the ASK command and an #IF within the DECLARE-REPORT paragraph to avoid
issues b) and c) (as Scott Hitchock mentioned).

If you need to choose the orientation at run time, you can work around
c) with something like this:

    move $sqr-report to $initial_report_filespec
    If $p_mfg_rpt = 'Y'
       Use-report land
    Else
       Use-report port
    End-if
    new-report $initial_report_filespec

Hope that helps.

                                                Nathan

----------------------------------------------------------------------------
Nathan Stratton Treadway  | Ray Ontko & Co. | Software consulting services
nathant@ontko.com         | Richmond, IN    | http://www.ontko.com/