Skip to main content
Version: V2 (Ignition 8.1)

system.mes.trackandtrace.expandLotTraceGraph

Description​

Expands the children or parents of the given node in the track and trace graph by one level, and merges the result into the nodes and edges the caller already holds. The expansion itself is a getLotTraceGraph call at depth 1 from nodeId in the requested direction; nodes and edges that are already present are not duplicated.

This function is used by the trace graph component to grow the graph a level at a time as a user drills into it, without refetching the part that is already on screen.

Permissions​

This method requires the TRACK_AND_TRACE.READ.GET permission.

Syntax​

system.mes.trackandtrace.expandLotTraceGraph(**expandRequest)

Parameters​

ParameterTypeNullableDescription
nodeIdString (ULID)FalseThe ID of the inventory lot node to expand the graph from
directionStringFalseThe direction of the graph expansion. 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 existing graph with the newly found ones merged in, and rootNodeId is the nodeId that was expanded.

Code Example​

inventoryLotId = "01JZJZ1FSE-WAW6VBVG-4506XP0C"

# Start from a one level graph
traceGraph = system.mes.trackandtrace.getLotTraceGraph(inventoryLotId, "OUTPUT")

# Then grow it a level at a time from a node of interest
expandRequest = {
"nodeId": "01JRGMQQQR-FNYB310E-QATAWA9X",
"direction": "OUTPUT",
"existingNodes": traceGraph["nodes"],
"existingEdges": traceGraph["edges"]
}

expandedGraph = system.mes.trackandtrace.expandLotTraceGraph(**expandRequest)

print("%d nodes after expanding" % len(expandedGraph["nodes"]))