Looping through subfile
Posted: Thu Feb 15, 2024 6:34 pm
Good day
I have a grid in my front end but I have a subfile in the 5250 screen. The subfile has maximum on 14 entries per page and i can only have 7 pages. I can set the subfile and get the entries on the first page up until the 14th entry. But if I need to page down and hit enter I get a multiple key entry error and it just breaks everything. Can you please assist if possible on the matter. My code is below:
#pages := 7
#entries := 14
Begin_Loop To(#pages)
#STD_COUNT := 1
#POSCONN.getvalue From("WSLYN") Value(#STD_INT) Index(#STD_COUNT)
#POSCONN.getvalue From("WSBESKR") Value(#CXLBSE) Index(#STD_COUNT)
Begin_Loop To(#entries)
If Cond((#STD_INT = 0) *Or (#CXLBSE = *BLANK))
#POSCONN.setvalue Infield('WSVELD') Value(#CDX) Index(#STD_COUNT)
#POSCONN.setvalue Infield('WSHOEV') Value(#CDXQUANTI) Index(#STD_COUNT)
#POSCONN.setvalue Infield('WSKORTP') Value(#CardexDiscount) Index(#STD_COUNT)
Leave
Endif
#STD_COUNT += 1
#POSCONN.getvalue From("WSLYN") Value(#STD_INT) Index(#STD_COUNT)
#POSCONN.getvalue From("WSBESKR") Value(#CXLBSE) Index(#STD_COUNT)
End_Loop
If Cond(#STD_COUNT = 15)
#POSCONN.sendkey Key(#POSCONN.KeyPageDown)
Else
#POSCONN.sendkey Key(#POSCONN.KeyEnter)
Leave
Endif
End_Loop
I have a grid in my front end but I have a subfile in the 5250 screen. The subfile has maximum on 14 entries per page and i can only have 7 pages. I can set the subfile and get the entries on the first page up until the 14th entry. But if I need to page down and hit enter I get a multiple key entry error and it just breaks everything. Can you please assist if possible on the matter. My code is below:
#pages := 7
#entries := 14
Begin_Loop To(#pages)
#STD_COUNT := 1
#POSCONN.getvalue From("WSLYN") Value(#STD_INT) Index(#STD_COUNT)
#POSCONN.getvalue From("WSBESKR") Value(#CXLBSE) Index(#STD_COUNT)
Begin_Loop To(#entries)
If Cond((#STD_INT = 0) *Or (#CXLBSE = *BLANK))
#POSCONN.setvalue Infield('WSVELD') Value(#CDX) Index(#STD_COUNT)
#POSCONN.setvalue Infield('WSHOEV') Value(#CDXQUANTI) Index(#STD_COUNT)
#POSCONN.setvalue Infield('WSKORTP') Value(#CardexDiscount) Index(#STD_COUNT)
Leave
Endif
#STD_COUNT += 1
#POSCONN.getvalue From("WSLYN") Value(#STD_INT) Index(#STD_COUNT)
#POSCONN.getvalue From("WSBESKR") Value(#CXLBSE) Index(#STD_COUNT)
End_Loop
If Cond(#STD_COUNT = 15)
#POSCONN.sendkey Key(#POSCONN.KeyPageDown)
Else
#POSCONN.sendkey Key(#POSCONN.KeyEnter)
Leave
Endif
End_Loop