| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod ValidateInput ( | 
|   output String feedback_o, | 
|   output String sanitycheckfeedback_o, | 
|   MacroPlan owner, | 
|   String name, | 
|   Group group, | 
|   Boolean checkunique | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Check unique group name' | 
|   TextBody: | 
|   [* | 
|     feedback_o := ''; | 
|     sanitycheckfeedback_o := ''; | 
|      | 
|     // Name length limit | 
|     lengthlimit := GlobalParameters_MP::GetLengthOfNames(); | 
|     subname := MacroPlan::GetSubstituteName( name ); | 
|     instance := Translations::MP_Group_Instance( subname ); | 
|      | 
|     // Check if input name is valid | 
|     if( name = '' or  name.Length() > lengthlimit ) | 
|     { | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, | 
|                                                              Translations::MP_Group_ValidateInput_IsNameEmptyOrExceedLengthLimit( lengthlimit ) ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     } | 
|     // Check if input name is unique | 
|     else if( checkunique | 
|              and exists( owner, Group, g, | 
|                          g <> group, | 
|                          g.Name() = name ) ) | 
|     { | 
|       feedback_o := Translations::MP_Group_ValidateInput_IsNotUnique(); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     } | 
|      | 
|     // Add feedback text if any of the preconditions above is violated | 
|     if( feedback_o <> '' ) | 
|     { | 
|       gname := MacroPlan::GetSubstituteName( name ); | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( Translations::MP_Group_Instance( gname ), | 
|                                                              feedback_o ); | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |