Quintiq file version 2.0 #parent: #root Method FindCreatePISPIPNodeAndEdge ( shadow[SCVConfiguration] owner, shadow[SCVNode] ownernode, ProductInStockingPointInPeriod pispip, Boolean isupstream, Process_MP process, output Number depth ) as shadow[SCVNode] id:Method_FormSupplyChainVisualization_FindCreatePISPIPNodeAndEdge { #keys: '[133968.0.65085111]' Body: [* // Create a node that the current node will link to scvNode := this.GetPISPIPNode( ownernode, pispip, isupstream ); if( isnull( scvNode ) ) { scvNode := this.CreateSCVPISPIPNode( owner, pispip, false /*isroot*/ ); // Establish their linkage this.CreateSCVEdge( ownernode, scvNode, isupstream, process ); } // Quantity to grab edge value, so that we can truncate branch if the value is 0 quantity := 0.0; this.ReturnEdgeLabel( ifexpr( isupstream, scvNode, ownernode ), ifexpr( isupstream, ownernode, scvNode ), quantity ); // Set depth to 0, meaning stop the drilling, if( quantity = 0.0 and owner.IsHideZeroSupplyPaths() ) { scvNode.IsDepthLimitMet( true ); } else { // if it is upstream, we will generate inventory supply node, // if it is downstream, we will generate sales demand node if( isupstream ) { this.CreateSCVISNode( scvNode, pispip, isupstream ); } else { this.CreateSCVSDNode( scvNode, pispip, isupstream ); } } value := max( owner, SCVNode, e, e.Depth() = scvNode.Depth() and e.IsUpstream() = scvNode.IsUpstream(), e.SortSequence() ); scvNode.SortSequence( value + 1 ); return scvNode; *] }