-3
FOR EACH gdmf_shift NO-LOCK:BUFFER-COPY gdmf_shift EXCEPT shift_obj TO tt_shift.END.
 hOutSAXDocument:START-ELEMENT("Row").
    hOutSAXDocument:INSERT-ATTRIBUTE("id","5").   
         hOutSAXDocument:START-ELEMENT("Column").
         hOutSAXDocument:INSERT-ATTRIBUTE("id","C1").  
         hOutSAXDocument:WRITE-DATA-ELEMENT("Column",string(tt_orderinfo.shft_start_hour,"HH:MM")).
         hOutSAXDocument:WRITE-DATA-ELEMENT("Column",string(tt_orderinfo.shft_stop_hour,"HH:MM")).

See from above codes I got first start and stop hour and exported as XML but what I need is every hour which is resides in tt_data. See Like this

Thiru
  • 231
  • 6
  • 20

1 Answers1

0

It looks to me like you have the END statement in the wrong place.

FOR EACH gdmf_shift NO-LOCK:

 BUFFER-COPY gdmf_shift EXCEPT shift_obj TO tt_shift.  /* I don't see why you are doing this but maybe there is more code than is being shown */

 hOutSAXDocument:START-ELEMENT("Row").
 hOutSAXDocument:INSERT-ATTRIBUTE("id","5").   
 hOutSAXDocument:START-ELEMENT("Column").
 hOutSAXDocument:INSERT-ATTRIBUTE("id","C1").  
 hOutSAXDocument:WRITE-DATA-ELEMENT("Column",string(tt_orderinfo.shft_start_hour,"HH:MM")).
 hOutSAXDocument:WRITE-DATA-ELEMENT("Column",string(tt_orderinfo.shft_stop_hour,"HH:MM")).

  /* you  probably want to end the element here */

END.

It seems like you might be thinking of Progress 4GL/ABL as being sort of like SQL where a "result set" is returned and acted on as a whole. The 4GL is not like that. FOR EACH is a looping block -- each row is returned individually for you to act on. While it is superficially similar it is not the same as a SQL SELECT.

Your original code only acts on the last row because it happens to be "in scope" at the end of the "FOR EACH x WHERE y: ... END." block.

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
  • So there is no possiblities for return whole start and stop hour indivitually in progress 4gl? – Thiru Dec 24 '18 at 20:30
  • Also is there any chances that XML will generate with start and stop hour like the picture which is attached in main body? – Thiru Dec 24 '18 at 20:34
  • 1
    Based on your other questions and the data that you have shared I expect that the FOR EACH _is_ providing you hour by hour data. You would probably be better off pursuing your questions in a discussion forum where you can better clarify your requirements and get more flexible answers. – Tom Bascom Dec 24 '18 at 21:08