for each loop

tjsingh

Member
Hi

Just wondering if this is possible.

I have a for each loop like the following:

for each poi where poit.kco = 1
and poi.req-date = jp-date) no-lock:

but i need to do a check to see if a different date is filled in if it is then i will use that date (conft.date) otherwise use poi-req-date?

can this be done as i cannot use if statement after the and between parentheses

i am using progress V8

cheers

tj
 

mwm

New Member
First, you're missing the left paren, but in your example, parens aren't even needed.

You can do:
Code:
for each poi where poit.kco = 1
and poi.req-date = if conft.date > 1/1 then conft.date else jp-date no-lock:
 

tjsingh

Member
Hi

I need to determine in the if loop to see whether the program needs to use the req.date = jp-date or conf.date = jp-date. This is determined by the conf.date

How can i do this?
 

mwm

New Member
Please clarify if "conft" is a different table or if it you mean "conft-date". If the former, then what you want to do doesn't make sense to me, but if the latter, then you could do something like this:
Code:
for each poi where poi.kco = 1
and if poi.conft_date > 1/1 then poi.conft_date = jp-date else poi.req-date = jp-date no-lock:

HOWEVER, I would recommend a different way of doing this because this is going to be incredibly slow. I would make 2 separate passes through the table (one for poi.conft_date & poi.req-date), using a temp-table if necessary to build your list of records.
 
Top