Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Correct use of RI:Update(MyFile)

Status
Not open for further replies.

TinLegs

Programmer
Jan 14, 2003
100
NZ
Greetings fellow Clarion users. I have a bug in my program. (Clarion 5b Prof-Legacy)Cause: User goes to the parent update, returns and updates a child record then when they click on the next record on the parent browse list RIUpdate:Members() updates the newly selected records child file passing the PrimaryKey ID value of the previous record to the newly selected one. I believe this happens because I have the RI set as Cascade, which I need.

The purpose of the code below where this problem occurs is to allow a user to Tag/Un-Tag records by clicking in column 1 of the parent files browse list.

My question is: Can the code below be modified so the child files are not updated ie Would something like Update:Members2() work and be safe to use? ...OR... is my 'Ammended code:' OK? it appears to work fine but I am a bit nervous about using PUT(Members) <the parent file> here? You will also note I have now put the update within the IF....END Any assistance would be greatly appreciated.

It took me 2 weeks to find this bug and I only picked it up because I could hear data being written to the hard drive when it should'nt have been. Thanks.
!====================================================
! End of &quot;Sync Record routine, after lookups&quot;
! Start of &quot;Procedure Routines&quot;
! [Priority 50]
BRW1::SetValue:UpdateBrowseBox ROUTINE
!Code causing the below bug: Can this be modified to solve the problem?

IF KEYCODE() = MouseLeft AND ?MembersList{PROPLIST:MouseDownRow} > 0
DO SyncWindow
CASE ?MembersList{PROPLIST:MouseDownField}
OF 1 !Column 1 in Browse List
IF MBR:TagMember = 0 THEN MBR:TagMember = 1 ELSE MBR:TagMember = 0.
IF ERRORCODE() THEN STOP(ERROR()).
END

IF RIUpdate:Members(). !<<<< ???
IF ERRORCODE() THEN STOP(ERROR()).
DO BRW1::RefreshPage
DO BRW1::postNewSelection
END
!======================================================
!Ammended code: Seems to work fine but is it safe to use?
IF KEYCODE() = MouseLeft AND ?MembersList{PROPLIST:MouseDownRow} > 0
DO SyncWindow
CASE ?MembersList{PROPLIST:MouseDownField}
OF 1
IF MBR:TagMember = 0 THEN MBR:TagMember = 1 ELSE MBR:TagMember = 0.
IF ERRORCODE() THEN STOP(ERROR()).
PUT(members) !<< OK??
IF ERRORCODE()MESSAGE('Error with ' & ERRORFILE())
END
ForceRefresh = TRUE
DO RefreshWindow
END
END
 
I am a bit rusty on the Legacy code, but I think you may have to get the QUEUE before you do the SyncWindow bit as you are trapping the MouseLeft key.

Row# = ?MembersList{PROPLIST:MouseDownRow}
SELECT(?MembersList, Row#) !*** MAYBE UNNECESSARY
GET(BrowseQueue, Row#)

etc etc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top