Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetHasResultWithinAcceptableRange ( 
 | 
  Real weightedkpiinkt, 
 | 
  Boolean usemodelkpi 
 | 
) declarative as Boolean 
 | 
{ 
 | 
  Description: 'Return true if result is within acceptable range' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // desmondt Oct-9-2014 (created) 
 | 
     
 | 
    tolerance := AlgorithmRun::GetAbsoluteToleranceForKPI(); 
 | 
    tolerancepercentage := AlgorithmRun::GetAbsTolerancePercentageForKPI(); 
 | 
     
 | 
    kpi := ifexpr( usemodelkpi, this.WeightedModelKPI(), this.WeightedKPI() );  
 | 
     
 | 
    difference := abs( kpi - weightedkpiinkt ); 
 | 
     
 | 
    value :=  difference <= tolerance; 
 | 
     
 | 
    if( kpi <> 0 ) 
 | 
    { 
 | 
      value := value or difference / abs( kpi ) <= tolerancepercentage; 
 | 
    } 
 | 
     
 | 
    return value; 
 | 
  *] 
 | 
} 
 |