Alastair and JIm,
One important correction to the example Alastar supplied.
SWITCH (.vReportOutput)
Note the parenthesis. the switch varialble MUST always be enclosed in 
parenthesis.   
Jim Bentley
American Celiac Society
[EMAIL PROTECTED]
tel: 1-504-737-3293




________________________________
From: Jim Belisle <[EMAIL PROTECTED]>
To: RBASE-L Mailing List <[email protected]>
Sent: Tuesday, December 2, 2008 12:05:17 PM
Subject: [RBASE-L] - Re: Choosing report

 
Alastair,
 
Thanks for taking the time to explain the
use of the SWITCH/ENDSW command.  I have seen the command in the past and had
an idea of what its use was, but your taking the time to show me how to fill my
need, helps greatly.  I may try this later in this application just to get the
hang of the command.
 
Jim
 
 

________________________________
 
From:[email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alastair Burr
Sent: Tuesday, December 02, 2008
11:59 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Choosing
report
 
Jim,
 
On of the things it took me a long while to get around to learning and
using was the SWITCH/ENDSW command. Eventually, I had so many IF/ENDIF sections
that a better way for multiple choices just had to be found!
 
Razzak has already given you a solution to your CHOOSE question
but - to my mind - your following code screams out to use SWITCH/ENDSW.
 
Apologies if you know this already and/or have a reason to do it the
way you are. It's impertinent of me as well, but I wish I had known how to use
it earlier:
 
SWITCH .vReportOutput
  CASE 'Screen'
         PRINT
KayParkQuote WHERE QuoteID = .vQuoteID +
         OPTION
SCREEN|WINDOW_STATE MAXIMIZED +
        
|ZOOM_TYPE PERCENTAGE|ZOOMPERCENT 100
      BREAK
  CASE 'Printer'
         PRINT
KayParkQuote WHERE QuoteID = .vQuoteID +
         OPTION
PRINTER
      BREAK
  CASE 'PDF'
         SET VAR
vFileName = ('PDF\SalesQuote_'+.vQuoteID+'.PDF')
         PRINT
KayParkQuote WHERE QuoteID = .vQuoteID +
         OPTION
PDF +
         |FILENAME
&vFileName +
         |TITLE
Kay Park Recreation +
         |SUBJECT
Sales Quote +
         |AUTHOR
Sales Quote Processing Department +
         |OPEN ON
      BREAK
  DEFAULT
        GOTO
LabelEnd  --  whatever you need if one of the above is not chosen!
      BREAK
ENDSW
 
Also, even though you only have two reports at the moment and you could
use IF/ENDIF perfectly effectively you could also deal with a Report
choice to do nothing or any additional reports later were you to use
SWITCH/ENDSW after the CHOOSE process as well - especially if your report names
do not inform the users easily what one to choose:
 
CHOOSE vChoose FROM ...
SWITCH .vChoose 
  CASE 'KayParkQuote'
        SET VAR vReport =
'KayParkQuote'
      BREAK
  CASE 'KayParkOrder'  -- for example!
        SET VAR vReport =
'KayParkOrder'
      BREAK
  DEFAULT
        GOTO
LabelEnd  --  whatever you need if one of the above is not chosen!
      BREAK
ENDSW
 
If you were to use this after your CHOOSE then your PRINT
command first lines in my first example need to be changed to:
 
 
         PRINT
.vReport WHERE QuoteID = .vQuoteID +
 
The great advantage that I find with
SWITCH/ENDSW over IF/ENDIF is that it is so much easier to understand what you
are doing and to add (or remove) choices as requirements change.
 
Good luck,
Regards,
Alastair.
 
 
 
----- Original Message ----- 
From:Jim Belisle 
To:RBASE-L Mailing List 
Sent:Tuesday, December
02, 2008 1:20 PM
Subject:[RBASE-L] -
Choosing report
 
Below is the present syntax for printing a specific report
(KayParkQuote) to either the screen, printer or file.  What I want to do
is give the sales person the option of choosing between two different reports
rather than using only the one report.  Is the CHOOSE command the best
command to use?  I was thinking of using the below syntax right after the
THEN:
 
CHOOSE vreport FROM REPORTS WHERE (I am not sure what to put
here) IN (KayParkQuote,KayParkQuote_Price)
           
PRINT .vreport WHERE QuoteID = .vQuoteID
 
I would use the above command for all three choices.
 
(present syntax)
IF vReportOutput = 'Screen' THEN
         PRINT
KayParkQuote WHERE QuoteID = .vQuoteID +
         OPTION
SCREEN|WINDOW_STATE MAXIMIZED +
         |ZOOM_TYPE
PERCENTAGE|ZOOMPERCENT 100
      ENDIF
      IF vReportOutput = 'Printer'
THEN
         PRINT
KayParkQuote WHERE QuoteID = .vQuoteID +
         OPTION
PRINTER
      ENDIF
      IF vReportOutput = 'PDF' THEN
         SET VAR
vFileName = ('PDF\SalesQuote_'+.vQuoteID+'.PDF')
         PRINT
KayParkQuote WHERE QuoteID = .vQuoteID +
         OPTION PDF
+
         |FILENAME
&vFileName +
         |TITLE Kay
Park Recreation +
         |SUBJECT
Sales Quote +
         |AUTHOR
Sales Quote Processing Department +
         |OPEN ON
      ENDIF
 
Jim

________________________________
 

No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.176 / Virus Database: 270.9.12/1823 - Release Date: 01/12/2008
19:59


      

Reply via email to