Hi everyone,
When a file-buffer is being directly manipulated in a view, modal panel, etc., is it a good idea to reinstate the file-buffer after you've finished manipulating it.
Refer below for an example:
Code:
Procedure OnClick
String sValue sSeq x
RowID riTripTmp riTrip riPilot riDelays
Boolean bPBSTripExists bIsNull bFound
Integer iSeq iYear
//
// Store the current state of the file-buffers.
Move (GetRowID(TripTmp.File_Number)) to riTripTmp
Move (GetRowID(Delays.File_Number)) to riDelays
Move (GetRowID(Trip.File_Number)) to riTrip
Move (GetRowID(Pilot.File_Number)) to riPilot
//
// Begin the deletion and sequence number process.
Get Value of oeTicket 0 to sValue
Clear TripTmp
Move sValue to TripTmp.Id
Find eq TripTmp by 1 // Id (unique)
If (FindErr) Begin
Send Stop_Box "eTicket does not exist."
Move (IsNullRowID(riTripTmp)) to bIsNull
If (bIsNull = False) Move (FindByRowID(TripTmp.File_Number, riTripTmp)) to bFound
Procedure_Return
End
Else If (Found and TripTmp.Copied <> "") Begin
Send Stop_Box "This eTicket has already been transferred to the PBS System."
Move (IsNullRowID(riTripTmp)) to bIsNull
If (bIsNull = False) Move (FindByRowID(TripTmp.File_Number, riTripTmp)) to bFound
Procedure_Return
End
Else Begin // Everything is ok to delete the eTicket.
// ...
// Major processing here.
// ....
End
Send Info_Box "The selected eTicket (and associated delays, if any) has been successfully deleted." ""
// Unconditionally reinstate file-buffers.
Move (IsNullRowID(riTripTmp)) to bIsNull
If (bIsNull = False) Move (FindByRowID(TripTmp.File_Number, riTripTmp)) to bFound
Move (IsNullRowID(riDelays)) to bIsNull
If (bIsNull = False) Move (FindByRowID(Delays.File_Number, riDelays)) to bFound
Move (IsNullRowID(riTrip)) to bIsNull
If (bIsNull = False) Move (FindByRowID(Trip.File_Number, riTrip)) to bFound
Move (IsNullRowID(riPilot)) to bIsNull
If (bIsNull = False) Move (FindByRowID(Pilot.File_Number, riPilot)) to bFound
Send Close_Panel
End_Procedure
Regards,
Rachael