### Update Asset Group Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/updateAssetGroup Demonstrates how to call the updateAssetGroup function with required parameters. ```javascript assetGroupName = 'Group1' assetGroupId = 4 userId = 5 assetGroupId = system.kanoa.asset.updateAssetGroup(assetGroupName, assetGroupId, userId) ``` -------------------------------- ### Add Asset Tag UDT Instance Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/addAssetTagUDTInstance Demonstrates how to call the function with a specific asset ID. ```python assetId = 123 system.kanoa.asset.addAssetTagUDTInstance(assetId) ``` -------------------------------- ### Update Asset Mode Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/updateMode Demonstrates how to define the modeInfo dictionary and call the updateMode function with a user ID. ```python modeInfo = { 'modeName': 'Changeover', 'modeTypeId': 2, 'enabled': True, 'canSelect': True, 'canSchedule': False, 'modeColor': '#FF0000', 'iconPath': '/path/to/icon.png', 'modeId': 10 } userId = 123 updatedModeId = system.kanoa.asset.updateMode(modeInfo, userId) ``` -------------------------------- ### Configure Downtime Table Options Source: https://kanoa-software.netlify.app/releaseNotes/v1_11 Example JSON configuration for setting up the downtime table view parameters. ```json "options": {"sortDateAsc": true, "showDurationSecs": false, "minDurationMins": 5, ""showAllStates": false} ``` -------------------------------- ### Upsert Asset Mode Links Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/upsertAssetModeLinks Demonstrates the structure of the assetModeList and the function call to perform the bulk upsert. ```python assetModeList = [{'assetId': 901, 'modeId': 2, 'modeCode': 1, 'autoSchedule': True}] userId = 5 retVal, msg = system.kanoa.asset.upsertAssetModeLinks(assetModeList, userId) ``` -------------------------------- ### Update Asset Field Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/updateAssetField Demonstrates how to call the updateAssetField function with required parameters. ```python assetId = 12 field = "enabled" value = False userId = 5 recordsModified, message = system.kanoa.asset.updateAsset(assetId, field, value, userId) ``` -------------------------------- ### Update Attribute Example Source: https://kanoa-software.netlify.app/systemFunctions/attribute/updateAttribute Demonstrates how to define the attribute information dictionary and call the updateAttribute function. ```python attrInfo = { 'attributeId': 1, 'attributeName': 'some attribute name', 'attributeDescription': 'some description', 'parentId': 6, 'enabled': True } userId = 123 modifiedRecords = system.kanoa.attribute.updateAttribute(attrInfo, userId) ``` -------------------------------- ### Add Asset Group Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/addAssetGroup Demonstrates how to call the addAssetGroup function with a group name and user ID. ```javascript groupName = 'Group1' userId = 5 assetGroupId = system.kanoa.asset.addAssetGroup(groupName, userId) ``` -------------------------------- ### Custom Script Return Value Examples Source: https://kanoa-software.netlify.app/kanoa-quality/checkSheets Examples of return values for custom Python scripts, requiring a tuple of the result and an error message or None. ```python return 'Hello World', None ``` ```python '', 'An error occurred' ``` -------------------------------- ### Link Asset Modes Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/linkAssetModes Demonstrates the usage of linkAssetModes by defining the required lists and user ID before calling the function. ```javascript assetIdList = [100,101,102] modeList = [1,3,4] modeCodeList = [2,8,12] userId = 5 system.kanoa.asset.linkAssetModes(assetIdList, modeList, userId, modeCodeList) ``` -------------------------------- ### Link Asset States Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/linkAssetStates Demonstrates how to call the function with lists of asset IDs, state IDs, state codes, and a user ID. ```python assetIdList = [1,2,3] stateIdList = [101] stateCodeList = [3] userId = 5 retVal = system.kanoa.asset.linkAssetStates(assetIdList, stateIdList, userId, stateCodeList) ``` -------------------------------- ### Delete an attribute example Source: https://kanoa-software.netlify.app/systemFunctions/attribute/deleteAttribute Demonstrates the basic usage of the deleteAttribute function with required parameters. ```text attributeId = 1 userId = 123 success, message = system.kanoa.attribute.deleteAttribute(attributeId, userId) ``` -------------------------------- ### Upsert Asset State Links Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/upsertAssetStateLinks Demonstrates the required structure for the assetStateList and the function call to perform the bulk upsert. ```python assetStateList = [{'assetId': 901, 'stateId': 2, 'stateCode': 1}] userId = 5 retVal, msg = system.kanoa.asset.upsertAssetStateLinks(assetStateList, userId) ``` -------------------------------- ### Delete Asset Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/deleteAssets Demonstrates the basic usage of the deleteAssets function by providing an asset ID and user ID. ```python assetId = 123 userId = 456 retVal, message = system.kanoa.asset.deleteAssets(assetId, userId) ``` -------------------------------- ### Add Asset Type Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/addAssetType Demonstrates the structure of the assetTypeInfo dictionary and the function call to add a new asset type. ```python assetTypeInfo = { 'assetTypeName': 'Region', 'parentId': 1, 'enabled': True, 'iconPath': None } userId = 5 assetTypeId, msg = system.kanoa.asset.addAssetType(assetTypeInfo, userId) ``` -------------------------------- ### Update State Category Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/updateStateCategory Demonstrates how to define the stateCategoryInfo dictionary and call the update function with a user ID. ```python stateCategoryInfo={'stateCategoryId': 18, 'parentId': 4, 'stateCategoryName': 'Parts', 'enabled': True} userId = 5 retVal, message = system.kanoa.asset.updateStateCategory(stateCategoryInfo, userId) ``` -------------------------------- ### Update Asset Type Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/updateAssetType Demonstrates the structure of the assetTypeInfo dictionary and the function call to update an asset type. ```python assetTypeInfo = { 'assetTypeId': 456, 'assetTypeName': 'Region', 'parentId': 1, 'enabled': True, 'mobile': True, 'iconPath': 'material/insert_emoticon' } userId = 456 recordsModified = system.kanoa.asset.updateAssetType(assetTypeInfo, userId) ``` -------------------------------- ### Delete Asset Type Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/deleteAssetType Demonstrates the basic usage of the deleteAssetType function with assetTypeId and userId parameters. ```text assetTypeId = 123 userId = 456 success, message = system.kanoa.asset.deleteAssetType(assetTypeId, userId) ``` -------------------------------- ### Update an Asset Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/updateAsset Demonstrates retrieving a user ID and asset type ID before updating an asset's properties. ```python userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'}) assetTypeId = system.kanoa.utilities.getFieldValue('assetTypeId', system.kanoa.asset.getAssetTypes({'assetTypeName': 'enterprise'})) assetInfo = { 'assetId': 45, 'assetName': 'New Enterprise', 'parentId': None, 'assetTypeId': 1, 'assetGroupId': None, 'oeeEnabled': False, 'processTypeId': None, 'sortOrder': 1, 'enabled': True, 'timeZone': None } retVal, msg = system.kanoa.asset.updateAsset(assetInfo, userId) print retVal, msg >>> 1, None ``` -------------------------------- ### Forced Asset Deletion Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/deleteAssetsWithForce Demonstrates how to call the deleteAssetsWithForce function with an asset ID and user ID to remove an asset and its dependencies. ```sql assetId = 123 userId = 456 success, message = system.kanoa.asset.deleteAssetsWithForce(assetId, userId) ``` -------------------------------- ### Update Attribute Asset Link Example Source: https://kanoa-software.netlify.app/systemFunctions/attribute/updateAttributeAssetLink Demonstrates how to define the attribute asset information dictionary and call the update function. ```python attrAssetInfo = { 'attributeAssetLinkId': 67, 'attributeId': 3, 'assetId': 5, 'sourceTagPath': '[Kanoa]Kanoa Box Co/Box Plant/Packaging/Box Line 1/QDS/Compressor1/hoa', 'scaleFactor': 1.0, 'ignoreZeroValues': True, 'enabled': True } userId = 123 modifiedRecords, msg = system.kanoa.attribute.updateAttributeAssetLink(attrAssetInfo, userId) ``` -------------------------------- ### Initialize an asset counter Source: https://kanoa-software.netlify.app/systemFunctions/asset/addCounter Example showing the initialization of a counter named 'caps' of type 'infeed' for asset ID 18. ```python assetId = 18 counterName = 'caps' counterTypeName = 'infeed' userId = 123 counterId = system.kanoa.asset.addCounter(assetId, counterName, counterTypeName, userId) ``` -------------------------------- ### Get OLE Metrics Source: https://kanoa-software.netlify.app/kanoa-ops/ole-pole-analysis Computes OLE/POLE performance metrics based on raw seconds and production counts. ```sql mes.fnGetOLEMetrics(@scheduledSecs INT, @loggedInSecs INT, @productiveSecs INT, @infeedCount FLOAT, @outfeedCount FLOAT, @wasteCount FLOAT, @packageCount FLOAT, @standardRate FLOAT, @period VARCHAR(50)) RETURNS TABLE ``` -------------------------------- ### Add Attribute Asset Link Example Source: https://kanoa-software.netlify.app/systemFunctions/attribute/addAttributeAssetLink Demonstrates the structure of the attrAssetInfo dictionary and the function call to create a new attribute asset link. ```python attrAssetInfo = { 'attributeId': 3, 'assetId': 5, 'sourceTagPath': '[Kanoa]Kanoa Box Co/Box Plant/Packaging/Box Line 1/QDS/Compressor1/hoa', 'scaleFactor': 1.0, 'ignoreZeroValues': True, 'enabled': True } userId = 123 attributeAssetLinkId, msg = system.kanoa.attribute.addAttributeAssetLink(attrAssetInfo, userId) ``` -------------------------------- ### Define _ProductionDay attribute value Source: https://kanoa-software.netlify.app/configuration/attributes Example of the dictionary structure used to define start and end times for the _ProductionDay reserved attribute. ```python {'startTime': 0700, 'endTime': 1700} ``` -------------------------------- ### Unlink state from asset example Source: https://kanoa-software.netlify.app/systemFunctions/asset/unlinkAssetState Demonstrates how to call the function with a specific stateAssetLinkId and capture the return values. ```python stateAssetLinkId = 123 retVal, msg = system.kanoa.asset.unlinkAssetState(stateAssetLinkId) ``` -------------------------------- ### Link Attribute to Asset Example Source: https://kanoa-software.netlify.app/systemFunctions/attribute/setAttributeAssetLinkFromTag Demonstrates how to define the required parameters and call the function to retrieve an attribute asset link ID. ```python assetId = 901 attributeName = 'British Bangers' tagPath = '[Kanoa]Kanoa Box Co/Box Plant/Packaging/Box Line 1/Bacon' attributeAssetLinkId = system.kanoa.attribute.addAttributeAssetLink(assetId, attributeName, tagPath) ``` -------------------------------- ### Custom Script Parameter Dictionary Source: https://kanoa-software.netlify.app/kanoa-quality/checkSheets Example structure of the paramsDict dictionary passed to custom Python calculation scripts. ```python {'values': {'QR Scan': ['PIC3012017182#2237918#24011503']} ``` -------------------------------- ### Update Asset State Field Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/updateStateField Demonstrates updating the stateName field for a specific state ID. ```python stateId = 45 field = 'stateName' value = 'Really Blocked' userId = 5 modifiedRecords = system.kanoa.asset.updateStateField(stateId, field, value, userId) ``` -------------------------------- ### Update Asset Mode Field Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/updateAssetModeField Demonstrates updating the 'enabled' field for a specific asset mode link. ```python modeAssetLinkId = 123 field = 'enabled' value = False userId = 456 recordsModified, message = system.kanoa.asset.updateAssetModeField(modeAssetLinkId, field, value, userId) ``` -------------------------------- ### Delete Asset Tag Structure Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/deleteAssetTagStructure Demonstrates the usage of the function by defining the asset and user IDs before calling the deletion method. ```python assetId = 123 userId = 456 system.kanoa.asset.deleteAssetTagStructure(assetId, userId) ``` -------------------------------- ### Implement Node Chart Event Handler Source: https://kanoa-software.netlify.app/components/kanoa/nodechart Example of handling node chart events to extract raw data and update custom view properties. ```python # system.perspective.print(event) info = event.flowItem.data.rawData eventType = event.flowItem.data.type traceInfo = { "lotOperationEventId": info['lotOperationEventId'] if eventType == 'operation' else None, "lotId": info['lotId'] if eventType == 'lot' else None, "lotEventId": info['lotEventId'] if eventType == 'edge' else None } self.view.custom.traceInfo.click = traceInfo self.view.custom.traceInfo.info = event return ``` -------------------------------- ### Clear Navigation Item Project Source: https://kanoa-software.netlify.app/releaseNotes/v1_5 SQL command to clear the project field for navigation items in existing installations. ```sql UPDATE [core].[navigationItems] Set project = NULL ``` -------------------------------- ### Delete Asset Attribute Example Source: https://kanoa-software.netlify.app/systemFunctions/asset/deleteAssetAttribute Demonstrates the basic usage of the deleteAssetAttribute function with integer parameters for the attribute ID and user ID. ```javascript modifiedRecords = system.kanoa.asset.deleteAssetAttribute(123, 456) ``` -------------------------------- ### Implement Manual State Selector Script Source: https://kanoa-software.netlify.app/releaseNotes/v1_9 Custom script for the Manual State Selector widget to manage asset state changes. This should be added manually to existing installations to enable the new widget functionality. ```python def stateChange(paramsDict, userId): ''' This function can be called whenever an assets state changes and can be customized however needed. In this example we are assumng a cell on a line has changed state and the cells under the line drive the line state Args: paramsDict (dict) - assetInfo (dict) Returns: None Updated: jfc - 2/5/25 7:30am Created ''' log = system.util.getLogger("kanoaScripts") debug = system.tag.read("[Kanoa]kanoa/debug/tags/debugStates").value if debug: log.info("stateChange() called by %s with %s"%(userId, paramsDict)) assetInfo = paramsDict['assetInfo'] if paramsDict.has_key('assetInfo') else None assetPath = assetInfo['assetPath'] if assetInfo.has_key('assetPath') else None if assetPath: #Now we'll check if we need to update the line parentPath = "\\".join(assetPath.split("\\")[:-1]) assets = system.kanoa.utilities.convertDatasetToJSON(system.kanoa.asset.getAssets({'assetPath': parentPath + '\\%'})) tagPathList = [asset['tagPath'] + '/Line/OEE/StateTypeName' for asset in assets] tagPathValues = system.tag.readBlocking(tagPathList) assetStateTypeList = list(set([tagValue.value for tagValue in tagPathValues])) tagPathList = [asset['tagPath'] + '/Line/OEE/StateName' for asset in assets] tagPathValues = system.tag.readBlocking(tagPathList) assetStateList = list(set([tagValue.value for tagValue in tagPathValues])) if 'Running' in assetStateTypeList: parentState = 'Running' elif 'Unplanned Downtime' in assetStateTypeList: if 'Idle' in assetStateList: assetStateList.pop(assetStateList.index('Idle')) if 'Off Line' in assetStateList: assetStateList.pop(assetStateList.index('Off Line')) parentState = 'Idle' if len(assetStateList) == 0 else 'Down' elif 'Planned Downtime' in assetStateTypeList: parentState = 'Planned Down' else: parentState = 'Idle' parentTagPath = system.kanoa.asset.getAssetTagPath({'assetPath': parentPath}) currentStateName = system.tag.read(parentTagPath + '/Line/OEE/stateName').value if currentStateName != parentState: log.info("Setting %s to state %s"%(parentPath, parentState)) assetStateInfo = system.kanoa.utilities.convertDatasetRowToJSON(system.kanoa.asset.getAssetStates({'assetId': assetInfo['parentId'], 'stateName': parentState}),0) if assetStateInfo['stateCode']: stateInfo = {'assetId': assetInfo['parentId'], 'assetStateId': assetInfo['parentId'], 'stateCode': assetStateInfo['stateCode'], 'tStamp': system.date.now(), 'note': None} log.info("addStateEvent() called with %s"%stateInfo) stateEventId = system.kanoa.event.addStateEvent(stateInfo, userId) #We'll update the OEE state values for display purposes tagPath = '%s%s'%(parentTagPath, '/Line/OEE/') tagPathList = [tagPath+'stateName', tagPath+'stateTypeName', tagPath+'stateTypeColor', tagPath+'stateColor', tagPath+'stateIconPath'] tagPathValues = [assetStateInfo['stateName'], assetStateInfo['stateTypeName'] or '', assetStateInfo['stateTypeColor'] or '', assetStateInfo['stateColor'] or assetStateInfo['stateTypeColor'] or '', assetStateInfo['iconPath'] or ''] system.tag.writeBlocking(tagPathList, tagPathValues) else: log.warn("Couldn't find a stateCode for assetId %s %s"%(values['parentId'], parentState)) return ``` -------------------------------- ### Add or Update Asset Attribute Source: https://kanoa-software.netlify.app/systemFunctions/asset/addAssetAttribute Example usage of the addAssetAttribute function to set an attribute value for a specific asset. ```javascript assetId = 123 attrName = 'Attribute1' attrValue = 'Value1' userId = 456 assetAttributeId, message = system.kanoa.asset.addAssetAttribute(assetId, attrName, attrValue, userId) ``` -------------------------------- ### Get Standard Rate and Period Source: https://kanoa-software.netlify.app/kanoa-ops/ole-pole-analysis Resolves the standard rate and period basis for an asset as of a specific point in time. ```sql mes.fnGetStandardRateAndPeriod(@assetId INT, @asOf DATETIME) RETURNS TABLE (standardRate FLOAT, period VARCHAR(25)) ``` -------------------------------- ### Get Operator Session Seconds Source: https://kanoa-software.netlify.app/kanoa-ops/ole-pole-analysis Calculates total seconds a user was logged into an asset within a specified range. ```sql mes.fnGetOperatorSessionSeconds(@userId INT, @assetId INT, @rangeStart DATETIME, @rangeEnd DATETIME) RETURNS INT ``` -------------------------------- ### Get Operator Attribution Share Source: https://kanoa-software.netlify.app/kanoa-ops/ole-pole-analysis Calculates the time-weighted share of an asset's output attributable to a specific user. ```sql mes.fnGetOperatorAttributionShare(@userId INT, @assetId INT, @rangeStart DATETIME, @rangeEnd DATETIME, @attributionMode VARCHAR(20)) RETURNS FLOAT ``` -------------------------------- ### Get Operator Productive Seconds Source: https://kanoa-software.netlify.app/kanoa-ops/ole-pole-analysis Calculates seconds a user was logged into an asset while the asset was in a specific run state. ```sql mes.fnGetOperatorProductiveSeconds(@userId INT, @assetId INT, @rangeStart DATETIME, @rangeEnd DATETIME, @runStateTypeId INT) RETURNS INT ``` -------------------------------- ### Triggering State Change Interface Source: https://kanoa-software.netlify.app/configuration/assets Example of reading tag values to trigger the custom state change interface. This logic is typically executed when a tag value changes. ```python if currentValue.value != previousValue.value and currentValue.value is not None: #State interface is entirely customizable. You can pass whatever values you want to the system.kanoa.asset.custom.stateChange() function #which can be overridden in the runnable project to add any customization required tagValues = system.tag.readBlocking(["[.]../EquipID", "[.]Machine ID", "[.]Part Required", "[.]../eqPath"]) assetId = tagValues[0].value machineId = tagValues[1].value ``` -------------------------------- ### Importing an asset configuration Source: https://kanoa-software.netlify.app/systemFunctions/asset/importAsset Demonstrates importing asset data using an export dictionary and specifying creation flags for modes, states, and items. ```python exportAssetInfo = system.kanoa.asset.exportAssets(901) userId = 55 createModes = 'True' createStates = 'True' createItems = 'False' status = system.kanoa.asset.importAsset(exportAssetInfo, userId, createModes, createStates, createItems) ``` -------------------------------- ### Add a Procedure Step Source: https://kanoa-software.netlify.app/systemFunctions/cmms/addProcedureStep Demonstrates how to construct the procedure step configuration dictionary and call the addProcedureStep function. ```python userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'}) stepConfig = { 'dataTypeId': '5', 'engUnitId': None, 'specInfo': { 'specType': 'setPoint', 'setPoint': {'operator': '>', 'value': 10}, 'range': {'max': None, 'min': None}, 'regex': {'value': ''}, 'tolerance': {'tgt': None, 'lsl': None, 'usl': None, 'lel': None, 'lcl': None, 'ldl': None, 'udl': None, 'uel': None, 'ucl': None} }, 'pickListInfo': { 'pickListId': 8, 'pickListValues': { 'Fraction': {'max': None, 'increment': None, 'min': None}, 'Text': {'WARNING': [], 'PASS': [], 'FAIL': [], 'NEUTRAL': [], 'multiSelect': False}, 'Time': None, 'Number': {'max': None, 'increment': None, 'min': None}, 'Tree': '', 'Barcode Scanner': {'script': None}, 'Boolean': {'TRUE': ['Yes'], 'FALSE': ['No'] } } } } procedureStepInfo = { "procedureId": 12, "stepName": "Inspect belt tension", "stepDescription": "Visually inspect the conveyor belt for proper tension and signs of wear.", "stepConfig": system.util.jsonEncode(stepConfig), "sortOrder": 1, "estimatedMinutes": 5, "required": True, "enabled": True } procedureStepId, message = system.kanoa.cmms.addProcedureStep(procedureStepInfo, userId) print procedureStepId, message ``` -------------------------------- ### Copy an asset using system.kanoa.asset.copyAsset Source: https://kanoa-software.netlify.app/systemFunctions/asset/copyAsset Demonstrates how to invoke the copyAsset function with an asset ID and user ID to generate a new asset. ```python assetId = 123 userId = 456 newAssetId, msg = system.kanoa.asset.copyAsset(assetId, userId) ``` -------------------------------- ### Retrieve attribute events Source: https://kanoa-software.netlify.app/systemFunctions/attribute/getAttributeEvents Example usage of the getAttributeEvents function with a dictionary containing an attribute ID and end date. ```python paramsDict = {'attributeId': 5, 'endDate': None} data = system.kanoa.attribute.getAttributeEvents(paramsDict) ``` -------------------------------- ### Retrieve Asset States with Filters Source: https://kanoa-software.netlify.app/systemFunctions/asset/getAssetStates Demonstrates how to define a parameter dictionary and call the getAssetStates function to filter results. ```python paramsDict = {'enabled': True, 'assetId': 1} assetStates = system.kanoa.asset.getAssetStates(stateParams) ``` -------------------------------- ### Export Asset Configuration Source: https://kanoa-software.netlify.app/systemFunctions/asset/exportAsset Demonstrates how to export configuration details for a specific asset using its ID. ```text assetId = 5 assetExportInfo = system.kanoa.asset.exportAsset(assetId) ``` -------------------------------- ### Define a Calendar Event Object Source: https://kanoa-software.netlify.app/components/kanoa/calendar Example structure for an event object used within the events array property. ```json { "id": "1", "title": "Production Run A", "start": "2026-06-23T09:00:00", "end": "2026-06-23T11:00:00", "color": "#d40000", "contrastColor": "#ffffff" } ``` -------------------------------- ### Calculate OLE and POLE Metrics Source: https://kanoa-software.netlify.app/kanoa-ops/ole-pole-analysis Formulas for calculating availability, performance, quality, and the final OLE/POLE metrics. ```text oleAvailability = loggedInSecs / scheduledSecs poleAvailability = productiveSecs / scheduledSecs performance = rate achieved vs. standard rate, while productive quality = yield after waste ole = oleAvailability * performance * quality pole = poleAvailability * performance * quality ``` -------------------------------- ### Get Parts Below Reorder Threshold Source: https://kanoa-software.netlify.app/kanoa-inventory/inventory-guide Queries inventory stock to identify parts that have fallen below their defined reorder threshold. ```javascript data = system.kanoa.inventory.getPartInventoryStock({ 'inventoryAssetId': warehouseAssetId, 'isStocked': True, 'isBelowReorderThreshold': True, }) ``` -------------------------------- ### Attach a photo to a procedure step check Source: https://kanoa-software.netlify.app/systemFunctions/cmms/addImage Demonstrates how to retrieve image data from a component and pass it to the addImage function. ```python # Attach a photo captured from a camera/upload component to a procedure step check procedureStepCheckId = 4218 imageName = "torque-check-photo.jpg" imageType = "image/jpeg" imageDescription = "Torque wrench reading after tightening bolt pattern" # byte arrays typically come from a component such as a File Upload or Camera binding imageBytes = event.source.parent.getComponent('CameraCapture').primaryImage thumbnail = event.source.parent.getComponent('CameraCapture').thumbnailImage userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'}) imageId, msg = system.kanoa.cmms.addImage(procedureStepCheckId, imageName, imageType, imageDescription, imageBytes, thumbnail, userId) print imageId, msg ``` -------------------------------- ### Create a new maintenance procedure Source: https://kanoa-software.netlify.app/systemFunctions/cmms/addProcedure Demonstrates how to retrieve a user ID and define the procedure dictionary before calling the addProcedure function. ```python userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'}) procedureInfo = { 'enabled': True, 'procedureCategoryId': None, 'procedureName': 'CNC Lube', 'procedureDescription': 'CNC Coolant and Lubrication Service' } procedureId, msg = system.kanoa.cmms.addProcedure(procedureInfo, userId) print procedureId, msg ``` -------------------------------- ### system.kanoa.asset.addAssetTagUDTInstance(assetId) Source: https://kanoa-software.netlify.app/systemFunctions/asset/addAssetTagUDTInstance Creates the assets tag folder structure and assetOEE UDT instance for the given asset. ```APIDOC ## system.kanoa.asset.addAssetTagUDTInstance(assetId) ### Description Creates the assets tag folder structure and assetOEE UDT instance for the given asset. ### Parameters - **assetId** (Integer) - Required - Id of asset ### Returns - **None** ### Example ```python assetId = 123 system.kanoa.asset.addAssetTagUDTInstance(assetId) ``` ``` -------------------------------- ### Add a new asset Source: https://kanoa-software.netlify.app/systemFunctions/asset/addAsset Demonstrates how to retrieve a user ID and asset type ID before calling addAsset with a populated assetInfo dictionary. ```python userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'}) assetTypeId = system.kanoa.utilities.getFieldValue('assetTypeId', system.kanoa.asset.getAssetTypes({'assetTypeName': 'enterprise'})) assetInfo = { 'assetName': 'New Enterprise', 'parentId': None, 'assetTypeId': 1, 'assetGroupId': None, 'oeeEnabled': False, 'processTypeId': None, 'sortOrder': 1, 'enabled': True, 'timeZone': None } assetId, msg = system.kanoa.asset.addAsset(assetInfo, userId) print assetId, msg >>> 2076, None ``` -------------------------------- ### system.kanoa.asset.importAsset(exportInfo, userId, createModes, createStates, createItems) Source: https://kanoa-software.netlify.app/systemFunctions/asset/importAsset Imports all asset configuration including child assets, links to modes, states, items and attributes. ```APIDOC ## system.kanoa.asset.importAsset(exportInfo, userId, createModes, createStates, createItems) ### Description Imports all asset configuration including child assets, links to modes, states, items and attributes. ### Parameters - **exportInfo** (Dictionary) - Required - AssetInfo generated by the system.kanoa.asset.exportAsset() function. - **userId** (Integer) - Required - Id of user executing the function. - **createModes** (Boolean) - Required - When enabled, creates modes if they don't exist on target system. - **createStates** (Boolean) - Required - When enabled, creates states if they don't exist on target system. - **createItems** (Boolean) - Required - When enabled, creates items if they don't exist on target system. ### Returns - **status** (Dictionary) - Keys are 'passed' (bool) and 'message' (string). ### Example ```python exportAssetInfo = system.kanoa.asset.exportAssets(901) userId = 55 createModes = 'True' createStates = 'True' createItems = 'False' status = system.kanoa.asset.importAsset(exportAssetInfo, userId, createModes, createStates, createItems) ``` ``` -------------------------------- ### Define Checklist Metadata Source: https://kanoa-software.netlify.app/accelerators/startup-checklist The checklist is stored as a JSON-encoded list of Markdown strings within the Production Order Metadata using the key 'Startup Checklist'. ```json [ "**Step 1:** Confirm tooling is installed", "**Step 2:** Verify material is loaded", "**Step 3:** Validate machine setpoints" ] ``` -------------------------------- ### system.kanoa.inventory.addInventoryBin Source: https://kanoa-software.netlify.app/kanoa-inventory/inventory-config Adds a physical sub-location (bin) within an existing inventory location. ```APIDOC ## system.kanoa.inventory.addInventoryBin ### Description Adds a bin (physical sub-location) to a specified inventory location. ### Parameters - **inventoryLocationId** (int) - Required - The ID of the parent inventory location. - **binCode** (string) - Required - The unique code for the bin. - **binDescription** (string) - Required - Description of the bin location. - **isActive** (boolean) - Required - Whether the bin is active. - **userId** (int) - Required - The ID of the user performing the action. ### Response - **binId** (int) - The ID of the created bin. - **err** (string) - Error message if applicable. ``` -------------------------------- ### Create a new procedure category Source: https://kanoa-software.netlify.app/systemFunctions/cmms/addProcedureCategory Demonstrates how to define category information and execute the function to create a new top-level category. ```python userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'}) procedureCategoryInfo = { "procedureCategoryName": "Conveyors", "parentId": None, "enabled": True } procedureCategoryId, message = system.kanoa.cmms.addProcedureCategory(procedureCategoryInfo, userId) print procedureCategoryId, message ``` -------------------------------- ### system.kanoa.asset.addAsset(assetInfo, userId) Source: https://kanoa-software.netlify.app/systemFunctions/asset/addAsset Adds a new asset to the system. All keys within the assetInfo dictionary are required. ```APIDOC ## system.kanoa.asset.addAsset(assetInfo, userId) ### Description Adds a new asset to the system. ### Parameters - **assetInfo** (Dictionary) - Required - Contains asset details: - **assetGroupId** (Integer) - Id of asset group. Can be None. - **assetName** (String) - Name of asset. - **assetTypeId** (Integer) - Id of asset type. - **enabled** (Boolean) - Status of the asset. - **oeeEnabled** (Boolean) - Set to True if state and count data will be collected. - **parentId** (Integer) - Id of parent asset. Can be None. - **processTypeId** (Integer) - Id of process type. Can be None. - **sortOrder** (Integer) - Sort order index. - **timeZone** (String) - Time zone string (e.g., 'Pacific Standard Time'). - **userId** (Integer) - Required - Id of the user executing the function. ### Returns - **assetId** (Integer) - The ID of the newly created asset. - **message** (String) - Returns None if successful. ### Example ```python assetInfo = { 'assetName': 'New Enterprise', 'parentId': None, 'assetTypeId': 1, 'assetGroupId': None, 'oeeEnabled': False, 'processTypeId': None, 'sortOrder': 1, 'enabled': True, 'timeZone': None } assetId, msg = system.kanoa.asset.addAsset(assetInfo, userId) ``` ``` -------------------------------- ### Add a new attribute Source: https://kanoa-software.netlify.app/systemFunctions/attribute/addAttribute Demonstrates how to define the attribute information dictionary and execute the addAttribute function. ```python attrInfo = { 'attributeName': 'some attribute name', 'attributeDescription': 'some description', 'parentId': 6, 'enabled': True } userId = 123 attributeId = system.kanoa.attribute.addAttribute(attrInfo, userId) ``` -------------------------------- ### Manage Inventory Locations and Bins Source: https://kanoa-software.netlify.app/kanoa-inventory/inventory-config Use these functions to define storeroom locations and physical bins within the asset hierarchy. ```python # Create a storeroom location locationId, msg = system.kanoa.inventory.addInventoryLocation({ 'assetId': 45, 'locationName': 'Parts Room', 'locationCode': 'PR', 'locationType': 'Storeroom', 'isActive': True, }, userId) # Add a bin within that location binId, err = system.kanoa.inventory.addInventoryBin({ 'inventoryLocationId': 46, 'binCode': 'A3', 'binDescription': 'Shelf A, Row 3', 'isActive': True, }, userId) ``` -------------------------------- ### system.kanoa.asset.addMode(modeInfo, userId) Source: https://kanoa-software.netlify.app/systemFunctions/asset/addMode Adds a new mode to the system. Requires a dictionary of mode information and the executing user's ID. ```APIDOC ## system.kanoa.asset.addMode(modeInfo, userId) ### Description Adds a new mode to the system. All keys within the modeInfo dictionary are required. ### Parameters - **modeInfo** (Dictionary) - Required - Configuration object for the mode: - **canSchedule** (Boolean) - **canSelect** (Boolean) - **enabled** (Boolean) - **iconPath** (String) - **modeColor** (String) - i.e '#FF0000' - **modeName** (String) - **modeTypeId** (Integer) - **userId** (Integer) - Required - Id of user executing the function ### Returns - **modeId** (Integer) - The unique identifier of the created mode. ### Example ```python modeInfo = { 'modeName': 'NewMode', 'modeTypeId': 1, 'enabled': True, 'canSelect': True, 'canSchedule': False, 'modeColor': '#00FF00', 'iconPath': '/path/to/icon' } userId = 5 modeId = system.kanoa.asset.addMode(modeInfo, userId) ``` ``` -------------------------------- ### Configure Asset State and Trigger State Change Source: https://kanoa-software.netlify.app/configuration/assets Determines the asset state based on tag quality or configuration and executes a state change update. ```python assetStateId = machineId or assetId #The stateCode can come from a cell of the asset that has its own states defined. This tells us the lookup for the stateCode userId = system.tag.read("[.]../Configuration/userId").value if currentValue.quality.isGood(): stateCode = currentValue.value else: stateCode = system.kanoa.utilities.getFieldValue('stateCode', system.kanoa.asset.getAssetStates({'assetId': assetId, 'stateName': 'Off Line'})) stateChange({'assetId': assetId, 'assetStateId': assetStateId, 'stateCode': stateCode, 'partReqd': tagValues[2].value, 'tStamp': currentValue.timestamp, 'note':None, 'assetPath': tagValues[3].value}, userId) return ``` -------------------------------- ### Define Breadcrumb items hierarchy Source: https://kanoa-software.netlify.app/components/kanoa/breadcrumb Example structure for the items property, showing nested nodes with IDs, labels, data payloads, and children. ```json [ { "id": "home", "label": "Home", "data": {}, "children": [ { "id": "reports", "label": "Reports", "data": { "section": "reports" }, "children": [ { "id": "q1", "label": "Q1 2026", "data": { "period": "2026-Q1" }, "children": [] } ] }, { "id": "archive", "label": "Archive", "disabled": true, "data": {}, "children": [] } ] } ] ``` -------------------------------- ### system.kanoa.asset.addState(stateInfo, userId) Source: https://kanoa-software.netlify.app/systemFunctions/asset/addState Adds a new state to the system. All keys within the stateInfo dictionary are required. ```APIDOC ## system.kanoa.asset.addState(stateInfo, userId) ### Description Adds a new state. All stateInfo keys are required. ### Parameters - **stateInfo** (Dictionary) - Required - **assetGroupId** (Integer) - Required - **enabled** (Boolean) - Required - **stateCategoryId** (Integer) - Required - **stateColor** (String) - Required - i.e. '#FF0000' - **stateName** (String) - Required - **stateTypeId** (Integer) - Required - **userId** (Integer) - Required - Id of the user executing the function ### Returns - **stateId** (Integer) - **message** (String) - None if success ### Example stateInfo = { 'stateName': 'Blocked', 'stateColor': '#00FF00', 'stateCategoryId': 1, 'stateTypeId': 1, 'assetGroupId': 1, 'enabled': True } userId = 456 stateId, msg = system.kanoa.asset.addState(stateInfo, userId) ``` -------------------------------- ### Retrieve Asset Modes with Parameters Source: https://kanoa-software.netlify.app/systemFunctions/asset/getAssetModes Demonstrates filtering asset modes by a specific asset ID and enabled status. ```python paramsDict = {'assetId': 901, 'enabled': True} assetModes = system.kanoa.asset.getAssetModes(paramsDict) ``` -------------------------------- ### Retrieve Asset Attributes with Filters Source: https://kanoa-software.netlify.app/systemFunctions/asset/getAssetAttributes Demonstrates how to filter asset attributes by enabled status and asset path using a dictionary. ```python paramsDict = {'enabled': True, 'assetPath': 'Kanoa Industries%'} assetAttributes = system.kanoa.asset.getAssetAttributes(paramsDict) ``` -------------------------------- ### Retrieve operational assets Source: https://kanoa-software.netlify.app/systemFunctions/asset/getOperationalAssets Fetches all assets with production data by passing an empty dictionary. ```python paramsDict = {} operationalAssets = system.kanoa.asset.getOperationalAssets(paramsDict) ``` -------------------------------- ### Retrieve Asset OEE Thresholds Source: https://kanoa-software.netlify.app/systemFunctions/asset/getAssetOEEThresholds Fetches OEE threshold settings using an asset path. Requires either an assetId or assetPath parameter. ```python system.kanoa.asset.getAssetOEEThresholds({"assetPath": 'Kanoa Box Co\Box Plant\Packaging\Box Line 1'}) ``` -------------------------------- ### Retrieve Attribute Event Totals Source: https://kanoa-software.netlify.app/systemFunctions/attribute/getAttributeEventTotals Demonstrates how to define a parameter dictionary with date ranges and retrieve the resulting event totals. ```python paramsDict = {'attributeId': 5, 'startDate': system.date.parse("2026-01-01 00:00:00"), 'endDate': system.date.parse("2026-01-02 00:00:00")} data = system.kanoa.attribute.getAttributeEventTotals(paramsDict) ``` -------------------------------- ### Retrieve Asset Types with Filter Source: https://kanoa-software.netlify.app/systemFunctions/asset/getAssetTypes Demonstrates how to filter asset types by setting the enabled status in the parameters dictionary. ```python paramsDict = {'enabled': True} assetTypeData = system.kanoa.asset.getAssetTypes(paramsDict) ``` -------------------------------- ### system.kanoa.asset.populateAssetHierarchy() Source: https://kanoa-software.netlify.app/systemFunctions/asset/populateAssetHierarchy Calls the stored procedure spPopulateAssetHierarchy to rebuild the assetHierarchy_MAT table. ```APIDOC ## system.kanoa.asset.populateAssetHierarchy() ### Description Calls the stored procedure spPopulateAssetHierarchy to rebuild the assetHierarchy_MAT table. ### Parameters None ### Returns None ``` -------------------------------- ### Add a counter tag Source: https://kanoa-software.netlify.app/systemFunctions/asset/addCounterTag Demonstrates the basic usage of adding a counter tag using specific counter and user IDs. ```python counterId = 45 userId = 5 tagPath, message = system.kanoa.asset.addCounterTag(counterId, userId) ``` -------------------------------- ### OLE and POLE Calculation Formulas Source: https://kanoa-software.netlify.app/kanoa-ops/ole-pole-analysis Mathematical formulas for calculating OLE and POLE availability, performance, quality, and final metrics. ```text oleAvailability = loggedInSecs / scheduledSecs poleAvailability = productiveSecs / scheduledSecs performance = rate achieved vs. standard rate, while productive quality = yield after waste ole = oleAvailability * performance * quality pole = poleAvailability * performance * quality ``` -------------------------------- ### Retrieve asset states with parameters Source: https://kanoa-software.netlify.app/systemFunctions/asset/getStates Fetches asset states filtered by the enabled status. ```python stateData = system.kanoa.asset.getStates({'enabled': True}) ``` -------------------------------- ### system.kanoa.inventory.addInventoryLocation Source: https://kanoa-software.netlify.app/kanoa-inventory/inventory-config Creates a new storeroom location as an inventory asset node. ```APIDOC ## system.kanoa.inventory.addInventoryLocation ### Description Creates a new inventory location (storeroom) within the asset hierarchy. ### Parameters - **assetId** (int) - Required - The ID of the asset node. - **locationName** (string) - Required - The name of the location. - **locationCode** (string) - Required - The unique code for the location. - **locationType** (string) - Required - The type of location (e.g., 'Storeroom'). - **isActive** (boolean) - Required - Whether the location is active. - **userId** (int) - Required - The ID of the user performing the action. ### Response - **locationId** (int) - The ID of the created location. - **msg** (string) - Status message. ``` -------------------------------- ### Check and Enable RCSI for SQL Server Source: https://kanoa-software.netlify.app/getting-started/installation/other Use these SQL commands to verify the current RCSI status and enable it for the kanoaCore database. Ensure you have dbOwner permissions before executing the ALTER DATABASE commands. ```sql SELECT is_read_committed_snapshot_on FROM sys.databases WHERE name = 'kanoaCore'; --USE master; --GO --ALTER DATABASE kanoaCore... --SET SINGLE_USER WITH ROLLBACK IMMEDIATE; --GO --ALTER DATABASE kanoaCore... --SET READ_COMMITTED_SNAPSHOT ON; --GO --ALTER DATABASE kanoaCore... --SET MULTI_USER; --GO ``` -------------------------------- ### Retrieve attribute asset links Source: https://kanoa-software.netlify.app/systemFunctions/attribute/getAttributeAssetLinks Demonstrates how to call the function with a dictionary containing an assetId. ```python paramsDict = {'assetId': 18} attributeAssetLinkData = system.kanoa.attribute.getAttributeAssetLinks(paramsDict) ``` -------------------------------- ### system.kanoa.asset.getProcessTypes(paramsDict) Source: https://kanoa-software.netlify.app/systemFunctions/asset/getProcessTypes Retrieves a dataset of process types based on optional filter criteria. ```APIDOC ## system.kanoa.asset.getProcessTypes(paramsDict) ### Description Returns process types such as 'batch', 'discrete', or 'continuous'. Parameter keys are optional. ### Parameters - **paramsDict** (Dictionary) - Optional - A dictionary containing filter criteria: - **enabled** (Boolean) - Optional - **processTypeId** (Integer) - Optional - **processTypeName** (String) - Optional ### Returns - **processTypeData** (pyDataset) - A dataset containing the requested process type information. ### Example ```python paramsDict = {'enabled': True} processTypeData = system.kanoa.asset.getProcessTypes(paramsDict) ``` ``` -------------------------------- ### Configure textEntry View Parameters Source: https://kanoa-software.netlify.app/kanoa-ops/dynamic-attributes Parameters for the textEntry view to create dynamic attribute events via a text field. ```json { "assetId": 614, "attributeName": "Crew Size", "userId": custom.security.userId } ``` -------------------------------- ### Add a new asset mode Source: https://kanoa-software.netlify.app/systemFunctions/asset/addMode Defines the mode configuration dictionary and executes the function to register the new mode. ```python modeInfo = { 'modeName': 'NewMode', 'modeTypeId': 1, 'enabled': True, 'canSelect': True, 'canSchedule': False, 'modeColor': '#00FF00', 'iconPath': '/path/to/icon' } userId = 5 modeId = system.kanoa.asset.addMode(modeInfo, userId) ``` -------------------------------- ### system.kanoa.inventory.getPartInventoryStock Source: https://kanoa-software.netlify.app/kanoa-inventory/inventory-guide Retrieves stock information for parts, including filtering by reorder thresholds. ```APIDOC ## system.kanoa.inventory.getPartInventoryStock ### Description Retrieves inventory stock data, useful for identifying parts that have fallen below reorder thresholds. ### Parameters - **inventoryAssetId** (string) - Required - The ID of the inventory location. - **isStocked** (boolean) - Optional - Filter by stocked status. - **isBelowReorderThreshold** (boolean) - Optional - Filter for parts below reorder threshold. ``` -------------------------------- ### Retrieve site timezone offset Source: https://kanoa-software.netlify.app/systemFunctions/asset/getSiteTimezoneOffset Demonstrates how to call the function using an assetId to retrieve the timezone offset in minutes and the timezone name. ```python paramsDict = {'assetId': 901} tzOffSetMins, timezone = system.kanoa.asset.getSiteTimezoneOffset(paramsDict) ``` -------------------------------- ### Retrieve Asset-Level OLE/POLE Data Source: https://kanoa-software.netlify.app/kanoa-ops/ole-pole-analysis Calculates whole-crew OLE/POLE for an asset or site. Uses different denominators for OLE and POLE availability calculations. ```sql mes.spGetOLEDataAsset(@assetId INT, @startDate DATETIME, @endDate DATETIME) ``` -------------------------------- ### Retrieve Previous Attribute Event Source: https://kanoa-software.netlify.app/systemFunctions/attribute/getPreviousAttributeEvent Demonstrates how to call the function with an asset ID, attribute ID, and a timestamp. ```python assetId = 33 attributeId = 45 tStamp = system.date.now() data = system.kanoa.attribute.getPreviousAttributeEvent(assetId, attributeId, tStamp) ```