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 "Sync Record routine, after lookups"
! Start of "Procedure Routines"
! [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:ostNewSelection
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
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 "Sync Record routine, after lookups"
! Start of "Procedure Routines"
! [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:ostNewSelection
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