Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod ValidateInput ( 
 | 
  output String feedback_o, 
 | 
  output String sanitycheckfeedback_o, 
 | 
  MacroPlan macroplan, 
 | 
  String id, 
 | 
  String currencyname, 
 | 
  Currency_MP currency, 
 | 
  Boolean checkuniqueid 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  Description: 'Validate input, called from designer' 
 | 
  TextBody: 
 | 
  [* 
 | 
    feedback_o := ''; 
 | 
    sanitycheckfeedback_o := ''; 
 | 
     
 | 
    //Name length limit 
 | 
    lengthlimit := GlobalParameters_MP::GetLengthOfNames(); 
 | 
     
 | 
    name := MacroPlan::GetSubstituteName( currencyname ); 
 | 
     
 | 
    //no record with the same name 
 | 
    if( exists( macroplan, Currency_MP, c, 
 | 
                     c <> currency, 
 | 
                     c.Name() = currencyname ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Currency_ValidateInput_IsNotUniqueName(); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
    } 
 | 
    //no record with the same id 
 | 
    else if( checkuniqueid 
 | 
             and exists( macroplan, Currency_MP, c, 
 | 
                         c <> currency, 
 | 
                         c.ID() = id ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Currency_ValidateInput_IsNotUniqueID(); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); 
 | 
    } 
 | 
    else if( currencyname = '' 
 | 
        or  currencyname.Length() > lengthlimit ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Currency_ValidateInput_IsInvalidName( lengthlimit ); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); 
 | 
    } 
 | 
    else if( id = '' 
 | 
             or  id.Length() > lengthlimit ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Currency_ValidateInput_IsInvalidID( lengthlimit ); 
 | 
      sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); 
 | 
    } 
 | 
     
 | 
    if( feedback_o <> '' ) 
 | 
    { 
 | 
      instance := Translations::MP_Currency_Instance( name ); 
 | 
      feedback_o := SanityCheckMessage::GetFormattedMessage( instance, feedback_o ); 
 | 
    } 
 | 
     
 | 
    return feedback_o = ''; 
 | 
  *] 
 | 
} 
 |