Using 'in'

velvettiger

New Member
Hi Guys,

I am trying to use the 'in' keyword in progress and I think the way I am using it is incorrect. Can anyone point how how you would use the equivalent in progress? Any help is greatly appreciated.

Code:
   OUTPUT TO C:\cal\Barbados.TXT.
 SESSION:DATE-FORMAT = "ymd".
FOR EACH statement-output FIELDS( card-no export-batch issue-date issue-no period-points redeemer-name statement-date subsidiary-id subsidiary-name tran-date tran-points tran-value
       
        ) 
where subsidiary-id in (3000,3001,3002,3003,3006,3008,3010,3016,3017,3018,3019,3021,3022,3024,3025,3026,3027,3028,3029,3030,3032,3033,3035,3050,3060,3070,3080,3100,3105,3110,3120,3130,3140,3150,3160,3170,3180,3190)
        and tran-date >=  DATE(10,12,2007)  and tran-date < DATE(06,28,2008)
        and issue-date >=  DATE(12,01,2007)  and issue-date < DATE(06,28,2008)

     
     NO-LOCK:
    

EXPORT 
    DELIMITER ","
   card-no 
   export-batch 
   string(statement-output.issue-date, '9999/99/99')
   issue-no 
   period-points 
   redeemer-name 
   string(statement-output.statement-date, '9999/99/99')
   subsidiary-id 
   subsidiary-name 
   string(statement-output.tran-date, '9999/99/99')
   tran-points 
   tran-value



     
    .

END.

OUTPUT CLOSE.
 
Do you have another way to find the values for subsidiary-id ? Because if this is the first field of a primary index then it would be a shame to waste it.....
If the numbers are supposed to be hardoced and connot be retrieved from the database then best pratice is to put them in a temp-table and use that in the query:


Code:
define variable iTmp as integer no-undo.
define variable cIDList as character no-undo.
 
define temp-table ttTemp no-undo
  field itsubsidiary-id  as integer.
 
assign cIdList = '3000,3001,3002,3003,3006,3008,3010,3016,3017,3018,3019,3021,3022,3024,3025,3026,3027,3028,3029,3030,3032,3033,3035,3050,3060,3070,3080,3100,3105,3110,3120,3130,3140,3150,3160,3170,3180,3190'.
 
do iTmp = 1 to num-entries(cIdList):
   create ttTemp.
   assign ttTemp.itsubsidiary-id = integer(entry(iTmp,cIdList)).
   release ttTemp.
end.  
 
OUTPUT TO C:\cal\Barbados.TXT.
 SESSION:DATE-FORMAT = "ymd".
 
for each ttTemp,
   each statement-output 
     where statements-output.subsidiary-id  = ttTemp.itsubsidiary-id
        and statements-output.tran-date >=  DATE(10,12,2007)
        and statements-output.tran-date < DATE(06,28,2008)
        and statements-output.issue-date >=  DATE(12,01,2007)
        and statements-output.issue-date < DATE(06,28,2008) no-lock:
 
 
    EXPORT 
        DELIMITER ","
       card-no 
       export-batch 
       string(statement-output.issue-date, '9999/99/99')
       issue-no 
       period-points 
       redeemer-name 
       string(statement-output.statement-date, '9999/99/99')
       subsidiary-id 
       subsidiary-name 
       string(statement-output.tran-date, '9999/99/99')
       tran-points 
       tran-value
    .
END.
 
output close.


HTH,

Casper.
 
use follow codes:
where index("3000,3001,3002,3003,3006,3008,3010,3016,3017,3018,3019,3021,3022,3024,3025,3026,3027,3028,302 9,3030,3032,3033,3035,3050,3060,3070,3080,3100,3105,3110,3120,3130,3140,3150,3160,3170,3180,3190",su bsidiary-id) > 0
 
Back
Top