Quintiq file version 2.0
#parent: #root
Method GetInputOutputs (
  ProductInStockingPointInPeriod pispip,
  Boolean isupstream
) as structured[ProcessInputOutput] id:Method_FormSupplyChainVisualization_GetInputOutputs
{
  #keys: '[134266.1.1803390902]'
  Body:
  [*
    // Retrive pispip as process output,
    // in desired sorting sequence
    inputoutputs := null( ProcessInputOutputs );
    
    if( isupstream )
    {
      inputoutputs := selectsortedset( pispip.ProductInStockingPoint_MP(), ProcessOutput, output,
                                       output.AsProcessOutput().IsEnabled()        
                                       and not output.ProductInStockingPoint_MP().Product_MP().IsByProduct(),// skip by-products
                                       this.GetSortingSequence( output.AsProcessOutput() ) ); 
    }
    else
    {
      inputoutputs := selectsortedset( pispip.ProductInStockingPoint_MP(), ProcessInput, input,
                                       input.AsProcessInput().IsEnabled()
                                       and not input.ProductInStockingPoint_MP().Product_MP().IsByProduct(),// skip by-products
                                       this.GetSortingSequence( input.AsProcessInput() ) );
    }
    
    return &inputoutputs;
  *]
  Declarative: true
  ReturnsOwning: true
}
