| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod Create ( | 
|   PeriodTaskOperation owner, | 
|   Real qty | 
| ) as DependentDemandInputGroup | 
| { | 
|   Description: "Create dependent demand based on operation's input product" | 
|   TextBody: | 
|   [* | 
|     ddig := null( DependentDemandInputGroup ); | 
|      | 
|     // Using the procedural relation (astypes) so that this can be executed without having | 
|     // to call transaction propagate within the same transaction | 
|     traverse( owner, | 
|               Process_MP.astype( Operation ).OperationInputOutput.astype( OperationInput ).BaseOperationLink, | 
|               bol, | 
|               not isnull( bol.OperationInputGroup() ) ) | 
|     { | 
|       ddig := select( owner, DependentDemandInputGroup, dig, dig.BaseOperationLink() = bol ); | 
|      | 
|       if( isnull( ddig ) ) | 
|       { | 
|         ddig := owner.DependentDemandInputGroup( relnew, | 
|                                                  OptimizerFulfilledQuantity := qty, | 
|                                                  BaseOperationLink := bol ); | 
|      | 
|         // Propagate the operation input relation | 
|         Transaction::Transaction().Propagate( relation( DependentDemandInputGroup, OperationInput ) ); | 
|       } | 
|     } | 
|      | 
|     return ddig; | 
|   *] | 
| } |