Looping through subfile

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
FBuckham
Posts: 5
Joined: Mon Oct 16, 2023 10:10 pm

Looping through subfile

Post by FBuckham »

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
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: Looping through subfile

Post by René Houba »

Hi FBuckham,

Can you give more details about the front-end.

Is this a Windows front-end?
Web?
Is this RAMP perhaps?

Kind regards,
René
FBuckham
Posts: 5
Joined: Mon Oct 16, 2023 10:10 pm

Re: Looping through subfile

Post by FBuckham »

It is a windows Front-end with a grid on it.
jtaljaard
Posts: 37
Joined: Thu Sep 21, 2023 9:29 pm

Re: Looping through subfile

Post by jtaljaard »

We are using RAMP to retrieve information from our backend subfile and populating it into our front-end windows grid control.
Tim McEntee
Posts: 57
Joined: Thu May 26, 2016 8:46 am

Re: Looping through subfile

Post by Tim McEntee »

Hi FBuckham,

It looks like you are trying to seven page down keys in a row. What you need to is do one at a time, wait for the screen to come back and press again.

Tim
Post Reply