| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GetHasValidContinuousLevels ( | 
|   output String feedback_o, | 
|   Boolean iswebapp | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Method to check whether the KPIWeight levels are continuous and start from level 1.' | 
|   TextBody: | 
|   [* | 
|      | 
|     isvalid := true; | 
|      | 
|     uniquevalues := selectuniquevalues( this, KPIWeight, weight, weight.Level() > 0, weight.Level() ); | 
|      | 
|     sortedvalues := selectsortedset( uniquevalues, Elements, level, true, level ); | 
|      | 
|     if( uniquevalues.Size() > 0 )   // There is at least a goal activated. We allow the optimizer run without any goal too. | 
|     { | 
|       delimiter := ", "; | 
|       maxlevel := sortedvalues.Element( sortedvalues.Size() - 1 ); | 
|       isvalid := sortedvalues.Size() = maxlevel | 
|       newlevels := construct( Strings ); | 
|        | 
|       if( not isvalid ) | 
|       {    | 
|         levels := sortedvalues.ToString( delimiter ); | 
|          | 
|         if( iswebapp ) | 
|         { | 
|           //web client level start from Constraint, priority 1,2..      | 
|           traverse( levels.Tokenize( delimiter ), Elements, e ) | 
|           { | 
|             i := [Number]e; | 
|              | 
|             if ( i >1 )  | 
|             { | 
|               i := i-1;   | 
|               newlevels.Add( [String]i ); | 
|             } | 
|             else | 
|             { | 
|               newlevels.Add( Translations::ScenarioManager_StrategyLevel_Constraints() ); | 
|             } | 
|           } | 
|           levels := newlevels.ToString( delimiter ); | 
|           | 
|           feedback_o := Translations::Strategy_ValidateInput_IsLevelContinuousWebApp( levels ); | 
|         } | 
|         else | 
|         { | 
|           feedback_o := Translations::Strategy_ValidateInput_IsLevelContinuous( levels ); | 
|         } | 
|       } | 
|     } | 
|     return isvalid; | 
|   *] | 
| } |