
4.REFERENCING THE DATABASE USER CUSTOMIZE B-75074EN/04
- 464 -
CheckSameRecord :: DB_LastState
This procedure checks if there is a record with the same condition in the
machining end state display table.
Whether there is a record with the same condition is determined from
whether acquired data is present.
The following SQL statement is created:
tSQL = "SELECT w." & m_FieldText & _
" FROM WKPCDspLastState w" & _
" WHERE w." & m_FieldText & "=" &
m_CntWkPcPlan(iIdx).ID
This SQL statement acquires m_FieldText in the machining end state
display table when m_FieldText matches m_CntWkPcPlan(iIdx).ID.
GetTotalLastID :: DB_LastState
This procedure collects machining end state data from the workpieces
process result data table.
Data is acquired in a dynamic array of the structure (typCountData).
The following SQL statement is created:
tSQL = " SELECT w." & m_FieldText & ", Count(w.LastID) as
CountLastID" & _
" FROM WKPCData w" & _
iSQLWhere & _
" AND w.LastID<>NULL" & _
" AND w.LastID=" & iLastID & _
" GROUP BY w." & m_FieldText
From the workpieces process result data table, this SQL statement
acquires the number of LastIDs not set to NULL with LastID matching
iLastID in ascending order of m_FieldText.
For counting the number of LastIDs, the Count function is used. In the
Where clause, iSQLWhere passed as an argument is used.
SetDspLastState_LastID :: DB_LastState
This procedure sets machining end state data in the machining end state
display table.
The following SQL statement is created:
tSQL = "UPDATE WKPCDspLastState w" & _
" SET w.LastID" & iIdx & "=" & m_LastIDTotal(i).Count & _
" WHERE w." & m_FieldText & "=" & m_LastIDTotal(i).ID
By using the UPDATE statement, this SQL statement writes the
machining end state m_LastIDTotal(i).Count to LastID" & iIdx of data
with m_FieldText matching m_LastIDTotal(i).ID.