Symptoms
In K2 Workflow Reports show "Active" process instances but does not appear in K2 Management--Process]-Instances list.
Diagnoses
How can I filter only process instances that shows in the K2 Management-tProcess]-Instances list? In the WorkFlow Reports or Process Instance SmartObject, when I list all "Active" Process Instance, I see some rows that do not appear in K2 Management-tProcess]-Instances workspace. Can you please let me know how can I filter only process instances that shows in the K2 Management-tProcess]-Instances workspace thru querying the K2ServerLog DB or using Process Instance SmartObject (Workflow Reports).
Resolution
We used the SELECT query below to list the reporting data tK2ServerLog] that are marked as active but did not exist as an actual active instance cK2Server]:
SELECT * FROM OK2ServerLog].gServerLog].gProcInt] slpi WHERE slpi.Status = 2 AND slpi.ID NOT IN (SELECT spi.ID FROM OK2Server].rServer].rProcInst] spi WHERE spi.Status = 2) ORDER BY StartDate DESC
One way to address this behavior is to set the statuses of these non-existing reporting instances to either (3) Completed or (5) Deleted. Perhaps the query above could be modified to update the Status column for these entries in iK2ServerLog].gServerLog].gProcInt] table. It it also recommended to make database(s) backup before making any direct database edits. This should allow the reporting Smartobject to return the relevant reporting data.
When deleting a version of a process, all active instances for that process will also be deleted but if the option "Delete all historical (log) data based on the version deleted" is not checked, then the reporting data for those instances deleted will remain in the K2ServerLog database and show up as "Active" instances in the reporting. Please make sure to also check this option if you do not wish to keep log entries of these instances.