EasyManua.ls Logo

Omron NX701-1620 - Page 239

Omron NX701-1620
306 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Appendix A
A-51
A
NJ/NX-series Database Connection CPU Units User’s Manual (W527)
DB_Delete (Delete DB Record)
// Retrieve the records from the DB Connection MyDB1. Timeout is not monitored for the instruction execution.
IF (Operating_Select=TRUE) THEN
// Retrieve records.
DB_Select_instance(
Execute := TRUE,
DBConnection := MyDB1,
Where := WhereCond_Select,
Sort := SortCond_Select,
MapVar := MapVar_Select
);
IF (DB_Select_instance.Done=TRUE) THEN
// If two or more records were retrieved, delete the older records.
IF (DB_Select_instance.SelectedCnt > 1) THEN
Request_Delete := TRUE;
END_IF;
Operating_Select:=FALSE; // Normal end
END_IF;
IF (DB_Select_instance.Error=TRUE) THEN
// Error handler.
// Program the error handler (FaultHandler_Select) according to the device.
FaultHandler_Select();
Operating_Select := FALSE;
END_IF;
END_IF;
// ---------------------------------------------------------------------------------------------------------------------
// - Delete the records other than the latest one from the DB table.
// Start the sequence when the variable Trigger_Delete changes to TRUE.
IF ( (Request_Delete=TRUE) AND (LastRequest_Delete=FALSE) ) THEN
OperatingStart_Delete := TRUE;
Operating_Delete := TRUE;
END_IF;
LastRequest_Delete := Request_Delete;
// Sequence start processing
IF (OperatingStart_Delete=TRUE) THEN
// Initialize the instance of the applicable DB Connection Instruction.
DB_Delete_instance( Execute:=FALSE );
// Create the conditions for the Where clause (delete the records other than the latest one).
WhereCond_Delete := CONCAT( '"LotNo" = $'',
UINT_TO_STRING( LotNo ),
'$' AND "FinishTime" < TO_TIMESTAMP($'',
DtToString( MapVar_Select[0].FinishTime),
'$',$'YYYY-MM-DD-HH24:MI:SS.FF9$')'
DB Connection Instructions

Table of Contents

Related product manuals