| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod ValidateInput ( | 
|   output String feedback_o, | 
|   output String sanitycheckfeedback_o, | 
|   MacroPlan macroplan, | 
|   String name, | 
|   SalesSegment_MP salessegment, | 
|   Boolean checkuniquename | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Validate user input on for sales segment in the Designer.' | 
|   TextBody: | 
|   [* | 
|     feedback_o := ''; | 
|     sanitycheckfeedback_o := ''; | 
|      | 
|     // Get the maximum length limit of names | 
|     namelengthlimit := GlobalParameters_MP::GetLengthOfNames(); | 
|     subname := MacroPlan::GetSubstituteName( name ); | 
|      | 
|     // Get formatted instance name | 
|     instance := Translations::MP_SalesSegment_Instance( subname ); | 
|      | 
|     // Check if name is unique | 
|     if( checkuniquename | 
|         and exists( macroplan, SalesSegment_MP, segment, | 
|                     salessegment <> segment, | 
|                     segment.Name() = name ) ) | 
|     { | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, | 
|                                                              Translations::MP_SalesSegment_ValidateInput_IsNotUnique() ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if the name is valid or is within the allowed length | 
|     else if( name = '' or name.Length() > namelengthlimit ) | 
|     { | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, | 
|                                                              Translations::MP_SalesSegment_ValidateInput_IsNameEmptyOrExceedLengthLimit( namelengthlimit ) ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |