| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod ValidateInput ( | 
|   output String feedback_o, | 
|   output String sanitycheckfeedback_o, | 
|   MacroPlan owner, | 
|   String name, | 
|   UnitOfMeasure_MP unitofmeasure, | 
|   Boolean checkunique, | 
|   Real factor | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Check unique unitofmeasure name' | 
|   TextBody: | 
|   [* | 
|     // Validate input for UnitOfMeasure | 
|     feedback_o := ''; | 
|     sanitycheckfeedback_o := ''; | 
|      | 
|     // Get the length limit of names | 
|     namelengthlimit := GlobalParameters_MP::GetLengthOfNames(); | 
|      | 
|     // Check if the name is unique | 
|     if( checkunique | 
|         and exists( owner, UnitOfMeasure_MP, uom, | 
|                     uom <> unitofmeasure, | 
|                     uom.Name() = name ) ) | 
|     { | 
|       feedback_o := Translations::MP_UnitOfMeasure_ValidateInput_IsNotUnique(); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if the name is provided or the length of the name is within the allowed range | 
|     else if( name = '' | 
|              or name.Length() > namelengthlimit ) | 
|     { | 
|       feedback_o := Translations::MP_UnitOfMeasure_ValidateInput_IsNameEmptyOrExceedLengthLimit( namelengthlimit ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     }     | 
|     else if( factor.IsNaN() ) | 
|     { | 
|       feedback_o := Translations::MP_UnitOfMeasure_ViolateDefaultFactor(); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning();   | 
|     } | 
|     else if( factor =0.0 ) | 
|     { | 
|       feedback_o := Translations::MP_UOM_ValidateInput_GreaterThan0( factor ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning();   | 
|     } | 
|     // Add instance text if any of the preconditions above are violated | 
|     if( feedback_o <> '' ) | 
|     { | 
|       instance := UnitOfMeasure_MP::GetInstanceText( name ); | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, feedback_o ); | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |