How to retrieve the multiple values in progress?

nihar

New Member
Hi,

How to retrieve the multiple values in progress? I want to retrieve multiple flight number for each aircraft.

For example in SQL :

SELECT * FROM SECTOR S WHERE S.latest-dep-date >= 08/06/09 AND S.latest-dep-date <='08/01/09' AND S.SERIAL ='EAA' AND S.FLIGHT-NO IN ('0265','0568','0489')

How to write the same query in Progress:

FOR EACH sector WHERE sector.latest-dep-date >= 08/06/09
AND sector.latest-dep-date <= 08/06/09 and sector.serial = 'EAA' and sector.flight-no in ('0265','0568','0489') NO-LOCK :
FIND uobj-tag WHERE uobj-tag.parent-obj-id = sector.obj-id
AND uobj-tag.tag-name = 'Fuel'
NO-ERROR.
IF NOT AVAIL(uobj-tag) THEN DO :
CREATE uobj-tag.
ASSIGN uobj-tag.parent-obj-id = sector.obj-id
uobj-tag.tag-name = 'Fuel'.
END.
END


The above query is not accepting, I am getting a syntax error.

Please help me.


Regards

Nihar
 
hi there,

Replace:
sector.flight-no in ('0265','0568','0489')
with the progress equivalent:
can-do('0265,0568,0489',sector.flight-no)
That is assuming sector.flight-no is a character based field it is slightly more complex if flight-no is an integer and you would most probably be better doing:
(sector.flight-no = 0265 or sector.flight-no = 0568 or sector.flight-no = 0489)


HTH Stu
 
You cannot do "and sector.flight-no in ('0265','0568','0489')"

the 4GL equivalent would be

LOOKUP ( sector.flight-no, "0265,0568,0489" ) > 0

BUT:

A construct like this will always cause a table scan and have bad performance.

Better would be

sector.flight-no = "0265" or sector.flight-no = "0568" or sector.flight-no = "0489"


NOT speaking about Progress index selection rules at all ...


HTH, RealHeavyDude.
 
Stuart,

While I run the below query, i am getting an error message "** One or more END statements is missing. (246)"


FOR EACH sector WHERE sector.latest-dep-date >= 08/06/09
AND sector.latest-dep-date <= 08/01/09 and sector.serial = 'EAA' and can-do('0265,0568,0489',sector.flight-no)
NO-LOCK :
FIND uobj-tag WHERE uobj-tag.parent-obj-id = sector.obj-id
AND uobj-tag.tag-name = 'Fuel Consumption'
NO-ERROR.
IF NOT AVAIL(uobj-tag) THEN DO :
CREATE uobj-tag.
ASSIGN uobj-tag.parent-obj-id = sector.obj-id
uobj-tag.tag-name = 'Fuel Consumption'.
END.

If we add end in the query, it is ok. But which line we have to add "end" ?


Thanks for your reply.

Regards
Nihar
 
The end you need to add is immediateley after the last line in your code(as it looks in your original example) I think you must have simply deleted it by mistake.
Code:
[SIZE=1]FOR EACH sector WHERE sector.latest-dep-date >= 08/06/09
      AND sector.latest-dep-date <= 08/01/09 and sector.serial = 'EAA' [/SIZE]
[SIZE=1]      and can-do('0265,0568,0489',sector.flight-no)
      NO-LOCK :
  FIND uobj-tag WHERE uobj-tag.parent-obj-id = sector.obj-id
   AND uobj-tag.tag-name = 'Fuel Consumption'
          NO-ERROR.
  IF NOT AVAIL(uobj-tag) THEN DO :
    CREATE uobj-tag.
    ASSIGN uobj-tag.parent-obj-id = sector.obj-id 
    uobj-tag.tag-name = 'Fuel Consumption'.
  END.[/SIZE]
[SIZE=1]END.[/SIZE]
I have put it in a code block with indentation so you can see one end associated with the "FOR EACH" and the other with the "DO:"
 
Back
Top