Skip to main content
Version: V2 (Ignition 8.1)

system.mes.trackandtrace.collapseLotTraceGraph

Description​

Collapses the children or parents of the given node in the track and trace graph. Every node reachable from nodeId in the requested direction is removed from the caller's graph, along with the edges that touched them. Any node that is left with no edges is dropped as well, except the node that was collapsed, which is always kept.

This is the inverse of expandLotTraceGraph, and is used by the trace graph component to fold a branch away again.

Permissions​

This method requires the TRACK_AND_TRACE.READ.GET permission.

Syntax​

system.mes.trackandtrace.collapseLotTraceGraph(**collapseRequest)

Parameters​

ParameterTypeNullableDescription
nodeIdString (ULID)FalseThe ID of the inventory lot node to collapse the graph from
directionStringFalseThe direction of the graph collapse. Can be either INPUT or OUTPUT
existingNodesList of nodesFalseThe nodes already present in the caller's graph, as returned by a previous trace graph call
existingEdgesList of edgesFalseThe edges already present in the caller's graph, as returned by a previous trace graph call

Returns​

A trace graph object with the same shape as the one returned by getLotTraceGraph: nodes, edges, rootNodeId and direction. The nodes and edges are the caller's graph with the collapsed branch removed, and rootNodeId is the nodeId that was collapsed.

Code Example​

# Collapse a branch that was previously expanded
collapseRequest = {
"nodeId": "01JRGMQQQR-FNYB310E-QATAWA9X",
"direction": "OUTPUT",
"existingNodes": expandedGraph["nodes"],
"existingEdges": expandedGraph["edges"]
}

collapsedGraph = system.mes.trackandtrace.collapseLotTraceGraph(**collapseRequest)

print("%d nodes after collapsing" % len(collapsedGraph["nodes"]))