Page 1 of 1
Links on subfile row not returning relative record number
Posted: Wed Oct 06, 2021 12:59 pm
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!
Re: Links on subfile row not returning relative record number
Posted: Wed Oct 06, 2021 4:48 pm
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.
Re: Links on subfile row not returning relative record number
Posted: Wed Oct 06, 2021 4:55 pm
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.
Re: Links on subfile row not returning relative record number
Posted: Wed Oct 06, 2021 4:58 pm
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.
Re: Links on subfile row not returning relative record number
Posted: Wed Oct 06, 2021 5:07 pm
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.
Re: Links on subfile row not returning relative record number
Posted: Wed Oct 06, 2021 5:40 pm
by Scott Klement
Yes, that's correct.
Re: Links on subfile row not returning relative record number
Posted: Wed Oct 06, 2021 5:49 pm
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
and readc finds the right row. It's when I click the link directly that it doesn't work.
Re: Links on subfile row not returning relative record number
Posted: Thu Oct 07, 2021 4:22 pm
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.
Re: Links on subfile row not returning relative record number
Posted: Fri Oct 08, 2021 4:02 pm
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
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.