Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod ValidateInput ( 
 | 
  output String feedback_o, 
 | 
  ScenarioManager owner, 
 | 
  Boolean hasparent, 
 | 
  Account parent, 
 | 
  String name, 
 | 
  Real budget, 
 | 
  String costdriver, 
 | 
  String timeunit, 
 | 
  Number lengthoftime, 
 | 
  Real cost, 
 | 
  Account account 
 | 
) remote as Boolean 
 | 
{ 
 | 
  Description: 'Validate input, called from designer' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Precondition used to validate the input for creating/editing an Account 
 | 
    feedback_o := ''; 
 | 
     
 | 
    // If name is empty 
 | 
    if( name = '' ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Account_ValidateInput_IsNullName(); 
 | 
    } 
 | 
    // If name is not unique 
 | 
    else if( exists( owner, KPI, a, 
 | 
                     account <> a, 
 | 
                     a.Name() = name ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Account_ValidateInput_IsNotUnique( name ); 
 | 
    } 
 | 
    // If budget is infinite/not entered 
 | 
    else if( budget.IsMinInfinity() or budget.IsMaxInfinity() or budget.IsInfinite() or budget.IsNaN() ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Account_ValidateInput_InvalidBudget(); 
 | 
    } 
 | 
    // To check if this account is assigning to its own child. 
 | 
    else if( hasparent  
 | 
             and not isnull( parent ) 
 | 
             and exists( parent.GetAllParent(), Elements, parentaccount, 
 | 
                         parentaccount = account ) ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Account_ValidateInput_InvalidParent(); 
 | 
    } 
 | 
    // If cost is infinite/not entered 
 | 
    else if( cost.IsMinInfinity() or cost.IsMaxInfinity() or cost.IsInfinite() or cost.IsNaN() ) 
 | 
    { 
 | 
      feedback_o := Translations::MP_Account_ValidateInput_InvalidCost(); 
 | 
    } 
 | 
    // If the cost driver matches the logic in AccountAssignment::GetTimeUnitVisibility. Currently, it's Time, Fixed, or Number of units 
 | 
    else if( AccountAssignment::GetTimeUnitVisibility( costdriver ) ) 
 | 
    { 
 | 
      // If time unit is not entered 
 | 
      if( timeunit.Length() = 0 ) 
 | 
      { 
 | 
        feedback_o := Translations::MP_Account_ValidateInput_IsNullTimeUnit(); 
 | 
      } 
 | 
      // If the entered time unit is less than or equals to zero 
 | 
      else if( lengthoftime <= 0 ) 
 | 
      { 
 | 
        feedback_o := Translations::MP_Account_ValidateInput_InvalidLengthOfTime(); 
 | 
      } 
 | 
    } 
 | 
    return feedback_o = ''; 
 | 
  *] 
 | 
} 
 |