Skip to main content

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

- assetIdIntegerThe asset the work order event is on, exactly
- assetPathStringEvery asset whose path starts with this (the asset and those under it, and a sibling whose name starts the same, such as Machine 10 for Machine 1). Use assetId for one asset
- assignedToInteger
- endDateDateTimeWith startDate
- isActiveBoolean
- requestedByInteger
- scheduleTypeIdInteger
- scheduleTypeNameString
- startDateDateTimeWith endDate: closed work order events due in the window. Active ones are returned whatever their due date (with isActive False, only closed ones due in the window)
- titleString
- workOrderEventNameString
- workOrderIdInteger
- workOrderNameTitleStringfilter on both the workOrderName and the title field
- workOrderPriorityIdInteger
- workOrderPriorityNameString
- workOrderStatusCategoryIdInteger
- workOrderStatusCategoryNameString
- workOrderStatusIdInteger
- workOrderStatusNameString

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
>>>