| Quintiq file version 2.0 | 
| #parent: #root | 
| Method PostProcessSanityCheckMessage | 
| { | 
|   TextBody: | 
|   [* | 
|     // Post-process all created SanityCheckMessages to trim the number of messages | 
|     // Get the maximum number of messages that can be shown | 
|     msglimit := this.MacroPlan().GlobalParameters_MP().SanityCheckLimit(); | 
|      | 
|     // Get all SanityCheckMessages | 
|     allmessages := selectset( this, SanityCheckMessage, msg, true, true );                                                                                    | 
|      | 
|     shownmessage := construct( SanityCheckMessages ); | 
|      | 
|     currentmsgcount := 0; | 
|      | 
|     // Traverse all SanityCheckMessages of data issue category and add them to the shownmessage set if the message count hasn't exceeded to limit yet | 
|     traverse( this, SanityCheckMessage, msg, msg.CategoryLevel() = SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue() and currentmsgcount < msglimit ) | 
|     { | 
|       shownmessage.Add( msg ); | 
|       currentmsgcount++; | 
|     }  | 
|      | 
|     // Traverse all SanityCheckMessages of data warning category and add them to the shownmessage set if the message count hasn't exceeded to limit yet | 
|     traverse( this, SanityCheckMessage, msg, msg.CategoryLevel() = SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning() and currentmsgcount < msglimit ) | 
|     { | 
|       shownmessage.Add( msg ); | 
|       currentmsgcount++; | 
|     }  | 
|      | 
|     // Traverse all SanityCheckMessages of planning issue category and add them to the shownmessage set if the message count hasn't exceeded to limit yet | 
|     traverse( this, SanityCheckMessage, msg, msg.CategoryLevel() = SanityCheckCategoryLevel::GetSanityCheckCategoryPlanningIssue() and currentmsgcount < msglimit ) | 
|     { | 
|       shownmessage.Add( msg ); | 
|       currentmsgcount++; | 
|     } | 
|      | 
|     // Traverse all SanityCheckMessages of planning warning category and add them to the shownmessage set if the message count hasn't exceeded to limit yet | 
|     traverse( this, SanityCheckMessage, msg, msg.CategoryLevel() = SanityCheckCategoryLevel::GetSanityCheckCategoryPlanningWarning() and currentmsgcount < msglimit ) | 
|     { | 
|       shownmessage.Add( msg ); | 
|       currentmsgcount++; | 
|     } | 
|      | 
|     // Traverse all SanityCheckMessages of unclassified error category and add them to the shownmessage set if the message count hasn't exceeded to limit yet | 
|     traverse( this, SanityCheckMessage, msg, msg.CategoryLevel() = SanityCheckCategoryLevel::GetSanityCheckCategoryUnclassifiedError() and currentmsgcount < msglimit ) | 
|     { | 
|       shownmessage.Add( msg ); | 
|       currentmsgcount++; | 
|     } | 
|      | 
|     // Get messages to be deleted | 
|     msgtoclear := allmessages.Difference( shownmessage ); | 
|      | 
|     // Delete the selected set of messages | 
|     traverse( msgtoclear, Elements, ele ) | 
|     { | 
|       ele.Delete(); | 
|     } | 
|   *] | 
| } |