| Quintiq file version 2.0 | 
| #parent: #root | 
| Method CreateStatisticsAndIssues | 
| { | 
|   Description: 'Create `LibOpt_Statistics` and `LibOpt_Issues` to highlight potential issues about this `LibOpt_Run`.' | 
|   TextBody: | 
|   [* | 
|     LibOpt_Statistic::CleanUp( this ); | 
|     //in order for statistics to be calculated properly you must enable iterations | 
|     //capture the HasIterations value here, turn on iterations and we will reset HasIterations at the end of this method | 
|     iterationsBefore := this.HasIterations(); | 
|     if( not iterationsBefore ) | 
|     { | 
|       this.HasIterations( true ); | 
|     } | 
|     Transaction::Transaction().Propagate( method( LibOpt_Run, CreateStatistics ) ); | 
|     this.CreateStatistics(); | 
|      | 
|     Transaction::Transaction().Propagate( method( LibOpt_Run, CreateIssues ) ); | 
|      | 
|     // We may need to redo the partial propagate as there is a bug in the propagator | 
|     failquick := 10; | 
|     while( failquick >= 0 and | 
|            exists( this, Statistic, statistic, statistic.CheckIsSummaryStatisticsRequired() = isnull( statistic.Summary() ) ) ) | 
|     { | 
|       if( this.AutoFixPartialPropagateBug() ) | 
|       { | 
|         info( 'Partial propagation incorrect' ); | 
|       } | 
|       else | 
|       { | 
|         error( 'Partial propagation incorrect. Please contact support. In the meantime, have an ORS extend LibOpt_Run.AutoFixPartialPropagateBug to return true to attempt to fix it.' ); | 
|       } | 
|        | 
|       Transaction::Transaction().Propagate( method( LibOpt_Run, CreateIssues ) ); | 
|       failquick--; | 
|     } | 
|      | 
|     if( failquick < 0 ) | 
|     { | 
|       error( 'Could not recover from the incorrect partial propagation after 10 attempts. Please contact support.' ); | 
|     } | 
|      | 
|     this.CreateIssues(); | 
|     //reset has iterations | 
|     this.HasIterations( iterationsBefore ); | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |