Links on subfile row not returning relative record number

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
hdavolt
New User
Posts: 12
Joined: Thu Jul 15, 2021 5:06 pm
First Name: Harel
Last Name: Davolt
Company Name: Pratt Industries
Contact:

Links on subfile row not returning relative record number

Post by hdavolt »

Hello,

Still fairly new to both Profound and RPG so bear with me :-)

Working on a test program to view/edit customer information. (CUSTMGR)

I have a subfile set up with "View/Edit" links bound to indicators dtlView and updView, respectively. I also have an "ondbclick" action set up to click the dtlView link as covered in the docs here.

I am then using readc in a subroutine to get the record and process the link:

Code: Select all

begsr readSubfile;
  readc CUSTSFL;
  if not %eof(CUSTMGR);
    select;
    when dtlView = *on;
      exsr loadDetail;
    when updView = *on;
      exsr loadUpdate;
    endsl;
  endif;
endsr;
The problem I'm having is, the dbclick action works correctly, i.e. double clicking row 4 returns RRN 4. However clicking on the links directly returns RRN of 1 no matter which record is clicked.

What could I be missing here?
Thanks!
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Links on subfile row not returning relative record number

Post by Scott Klement »

READC is going to read any row of the subfile that has changed. Are you certain there were no changes to row 1? Since you're not reading it in a loop, you'll always get only the first changed row.
hdavolt
New User
Posts: 12
Joined: Thu Jul 15, 2021 5:06 pm
First Name: Harel
Last Name: Davolt
Company Name: Pratt Industries
Contact:

Re: Links on subfile row not returning relative record number

Post by hdavolt »

I am not changing anything myself, as in, I run a subroutine to load the subfile (using a reade loop). Then I exfmt the display, where I click on one of the subfile links. Clearly it thinks something has changed? But I don't know what it would be.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Links on subfile row not returning relative record number

Post by Scott Klement »

Unless I misunderstood you, you have something like buttons called dtlView and updView that are bound to indicators. When you click them, they'd change the indicator from a 0 to a 1. That change from a 0 to a 1 is what I'm referring to... the value is changing, so, a READC will pick up the change.
hdavolt
New User
Posts: 12
Joined: Thu Jul 15, 2021 5:06 pm
First Name: Harel
Last Name: Davolt
Company Name: Pratt Industries
Contact:

Re: Links on subfile row not returning relative record number

Post by hdavolt »

Yes, I have two hyperlinks on the grid bound to the two indicators. I assumed that the indicator is getting set for a particular row. As in, if I click the link on the fourth record, I get a RRN = 4 as the first changed record.
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

Re: Links on subfile row not returning relative record number

Post by Scott Klement »

Yes, that's correct.
hdavolt
New User
Posts: 12
Joined: Thu Jul 15, 2021 5:06 pm
First Name: Harel
Last Name: Davolt
Company Name: Pratt Industries
Contact:

Re: Links on subfile row not returning relative record number

Post by hdavolt »

Alright, so I need to figure out why it's always seeing the first record as changed, I'll do some more debugging. As I mentioned when I double-click I have the action

Code: Select all

pui.click("dtlView." + row);
and readc finds the right row. It's when I click the link directly that it doesn't work.
hdavolt
New User
Posts: 12
Joined: Thu Jul 15, 2021 5:06 pm
First Name: Harel
Last Name: Davolt
Company Name: Pratt Industries
Contact:

Re: Links on subfile row not returning relative record number

Post by hdavolt »

After some further testing, it looks like every row in the subfile is getting marked as changed, not just the first row. It seems like dtlView and updView are acting as global indicators somehow. I have confirmed that they are members of the subfile record and not the control record.
hdavolt
New User
Posts: 12
Joined: Thu Jul 15, 2021 5:06 pm
First Name: Harel
Last Name: Davolt
Company Name: Pratt Industries
Contact:

Re: Links on subfile row not returning relative record number

Post by hdavolt »

Final Update: It was in fact a coding error on my part.

For the readc loop I had

Code: Select all

readc CUSTSFL;
if not %eof(CUSTMGR); 
Which should have been

Code: Select all

readc CUSTSFL;
if not %eof(); 
I was erroneously reading the display file for %eof, causing all records to be marked as read(?) after the first check. That's my best guess anyway.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests