system.kanoa.cmms.getWorkOrderEventCount(paramsDict)
Returns a count of work order events matching the optional filter criteria supplied in paramsDict, without requiring the caller to fetch the full set of matching event records.
This is intended for reporting- or dashboard-style use cases (for example, showing how many open work order events exist for a given asset) where only a total is needed.
As with getWorkOrderEvents, all keys within paramsDict are optional, and any key that is omitted is not applied as a filter.
Parameters
paramsDict Dictionary
| - assetPath | String | |
| - assignedTo | Integer | |
| - endDate | DateTime | |
| - isActive | Boolean | |
| - requestedBy | Integer | |
| - scheduleTypeId | Integer | |
| - scheduleTypeName | String | |
| - startDate | DateTime | |
| - title | String | |
| - workOrderEventName | String | |
| - workOrderId | Integer | |
| - workOrderNameTitle | String | filter on both the workOrderName and the title field |
| - workOrderPriorityId | Integer | |
| - workOrderPriorityName | String | |
| - workOrderStatusCategoryId | Integer | |
| - workOrderStatusCategoryName | String | |
| - workOrderStatusId | Integer | |
| - workOrderStatusName | String |
Returns
workOrderEventData pyDataset
Example
# Get a count of work order events for a certain maintenance work order
paramsDict = {'workOrderName': 'Clean out Bottle tops mechanism'}
data = system.kanoa.utilities.convertDatasetToJSON(system.kanoa.cmms.getWorkOrderEventCount(paramsDict))
for i, row in enumerate(data):
for k,v in row.items():
print k,v
>>>
workOrderEventStatusName Approved
count 3
workOrderEventStatusName Assigned
count 104
workOrderEventStatusName Cancelled
count 4
workOrderEventStatusName Completed
count 17
workOrderEventStatusName In Progress
count 3
workOrderEventStatusName On Hold
count 3
workOrderEventStatusName Open
count 51
>>>