ProcessDeleteTaskStatsData
Delete records from Taskstats table
Member of namespace
Maintenance ManagerSyntax
bool ProcessDeleteTaskStatsData ()
Parameters
- deleteOrphanData
- True deletes the records from TaskStats table which are orphan.Orphan records means those records in TaskStats table whose related data from the main tables are already deleted or does not exists.
- station
- Optional. If orphan data from TaskStats table to be deleted from specific station. In case nothing is provided then orphan records will be deleted from Taskstats table irrespective of station value.
- taskOperator
- Optional. If orphan data from TaskStats table to be deleted which belongs to specific task operator. In case nothing is provided then orphan records will be deleted from Taskstats table irrespective of Task Operator value.
- job
- Optional. If orphan data from TaskStats table to be deleted from specific task job for e.g Main Job. In case nothing is provided then orphan records will be deleted from Taskstats table irrespective of Job value.
QuerySetBatchRange () and QuerySetJobID () specifically states a filter query.
QuerySetBatchRange (str="xxx",str="xxx")
QuerySetJobID (str="Main Job")
ProcessDeleteTaskStatsData (bool=true,str="",str="",str="Main Job")
Returns
True, if the data deleted successfully. Otherwise, False.Level
Any level.
Details
- Orphan Data - Orphan data here refers to that data which do not have reference data in
main tables returned by Job monitor view. There is a possibility that batches from main tables gets
deleted earlier and data left over in the Taskstats table.
For example: ProcessDeleteBatchesEX action deletes the record from the main tables but not from the TaskStats table.
Query parameters using set of query actions cannot be used here. Since the query actions works on Job Monitor table data, and orphan data cannot be fetch from Job Monitor table.
Thus, action have the separate parameter list provided which can be used to delete the selected set of records.
- Non-Orphan Data - Non-Orphan data here refers to the data from Taskstats table which have
reference data in main tables. There can be scenario where the Taskstats data needs to be deleted
only or there can be a requirement where at the time of deleting batches using
ProcessDeleteBatchesEX action, the data from the TaskStats table needs to be deleted along with.
To set which all batches to be deleted from TaskStats table can be set using Query actions. Similar to ProcessDeleteBatchesEX action. One can use ProcessRunSqlQueryEx action to view the query formed and how many batches were fetched. To view the fetched batches please refer to LogWriteRecordSet action.
For more details, please refer action ProcessRunSqlQueryEX.
SetupOpenApplicationEX("TravelDocs", "", "TravelDocsAdm.mdb", "TravelDocsEng.mdb", "False", "", "", "1")
ProcessDeleteTaskStatsData(True,””,””,””)
The first parameter in the action is set to True which denotes, orphan records from Taskstats table is expected to be deleted. Rest of the optional parameters are not provided which denotes all orphan records, irrespective of any filter is expected to be deleted from the Taskstats table.
Example 2:
TaskStats table have few Orphan records along with other records and user wants to delete all Orphan records belongs to specific job.
SetupOpenApplicationEX("TravelDocs", "", "TravelDocsAdm.mdb", "TravelDocsEng.mdb", "False", "", "", "1")
ProcessDeleteTaskStatsData(True,””,””,”Main Job”)
The first parameter in the action is set to True which denotes, orphan records from Taskstats table is expected to be deleted but only those which belongs to Job ID Main Job.
Example 3:
SetupOpenApplicationEX("TravelDocs", "", "TravelDocsAdm.mdb", "TravelDocsEng.mdb", "False", "", "", "1")
QuerySetJobID(“Main Job”)
QuerySetStation(“1)
QuerySetStatus(“Cancelled”)
ProcessDeleteTaskStatsData(True,””,””,”Navigator Job”)
SetupOpenApplicationEX("TravelDocs", "", "TravelDocsAdm.mdb", "TravelDocsEng.mdb", "False", "", "", "1")
QuerySetJobID(“Main Job”)
QuerySetStation(“1)
QuerySetStatus(“Cancelled”)
ProcessDeleteBatchesEX()
ProcessDeleteTaskStatsData(False,””,””,””)
In this example ProcessDeleteBatchesEX action is called before ProcessDeleteTaskStatsData which means the ProcessDeleteBatchesEX action will delete the batches from the main tables. Thus, these batches corresponding data in TaskStats table will become orphan as no reference is available in database for them in main tables.
- -by setting parameter as False the action is expected to not delete any orphan records.
- -there is no non-orphan records for the given set of query actions available in Database. As they are already deleted and has become orphan now.
Example 5
SetupOpenApplicationEX("TravelDocs", "", "TravelDocsAdm.mdb", "TravelDocsEng.mdb", "False", "", "", "1")
QuerySetJobID(“Main Job”)
QuerySetStation(“1)
QuerySetStatus(“Cancelled”)
ProcessDeleteTaskStatsData(True,””,””,””)
ProcessDeleteBatchesEX()
In this example, the action will first delete all the orphan records. Then it will query for non-orphan data on the basis of query actions and will delete data from TaskStats Table. Later, ProcessDeleteBatchesEX action will delete the batches from main tables.
To view the count of non-orphan batches targeted for deletion, one can use ProcessRunSqlQueryEX action. To view these batches use the action LogWriteRecordSet action.
To view the count of orphan records that are going to be deleted can be seen in rrs logs. To view which all batches are going to be deleted, one need to check directly in database using a query.