JavaScript method: SCFile.getPurgedRowCount()

This method enables you to retrieve the number of HPE Service Manager records that were deleted from a table after invoking the doPurge() method.

Syntax

SCFile_object.getPurgedRowCount();

Arguments

There are no arguments for this method.

Return values

  • If successful, getPurgedRowCount() returns the number of records deleted by the last successful doPurge() call (which returned RC_SUCCESS). This value can be 0 if no records were deleted.
  • If getPurgedRowCount() is not able to retrieve the record count it will return -1.

The value returned by getPurgedRowCount is unaffected by any SCFile method call other than doPurge. It is also unaffected by a failed call to doPurge (returned RC_ERROR).

Example

This example does the following:

  • Searches the kmknowledgebaseupdates table for records where docid="docid1"
  • Deletes whatever it finds.

This example requires the following sample data:

  • Records in kmknowledgebaseupdates table where docid = "docid1"
var fileName = "kmknowledgebaseupdates";
var recordList = new SCFile(fileName);
var deleteRC = recordList.doPurge("docid = \"docid1\"");
if ( deleteRC == RC_SUCCESS )
{
  print ("doPurge succeeded");
  var purgedCount = recordList.getPurgedRowCount();
  if ( purgedCount >= 0 )
  {
    print(purgedCount + " records have been purged");
  }
  else
  {
    print("Could not retrieve purged record count");
  }
}
else
{
  print ("doPurge failed");
}