INLIST( ) Function Example

In this example, INLIST( ) determines the quarter of the year for the current month. The current month is stored to the variable gcMonth. Each CASE statement uses INLIST( ) to determine whether the contents of gcMonth can be found in a list of month names. The name of the quarter returned is stored to the variable gcReporTitle.

SET TALK ON
STORE CMONTH(DATE( )) TO gcMonth
DO CASE
   CASE INLIST(gcMonth,'January','February','March')
      STORE 'First Quarter' TO gcReporTitle
   CASE INLIST(gcMonth,'April','May','June')
      STORE 'Second Quarter' TO gcReporTitle
   CASE INLIST(gcMonth,'July','August','September')
      STORE 'Third Quarter' TO gcReporTitle
   OTHERWISE
      STORE 'Fourth Quarter' TO gcReporTitle
ENDCASE
WAIT WINDOW gcReporTitle