Quintiq file version 2.0
#parent: #root
Method SetIndicatorValue () id:Method_DialogCreateEditCampaign_MP_SetIndicatorValue
{
  #keys: '[149260.0.411110233]'
  Body:
  [*
    //Set indicator values according to entered duration, MinQty, and MaxQty
    durationbased := RadioButtonGroupQuantityDuration.BoundValue() = GlobalParameters_MP::GetCampaignTransitionsTypeDuration();  
    quantitybased := not durationbased;
    data := Dialog.Data();
    
    operation := minselect( data,CampaignType_MP.OperationInCampaignType.Operation, opr, true, opr.Throughput() );
    if( not isnull( operation ) )
    {
      if( quantitybased ) 
      {
        indicateddurationbasedonminqty := CampaignType_MP::GetDurationBasedOnQuantity( operation, ApplicationLibMacroPlanner.FormatStringToReal( EditorCampaignMinQuantity.Text() ), 0.0, true, false );
        indicateddurationbasedonmaxqty := CampaignType_MP::GetDurationBasedOnQuantity( operation, ApplicationLibMacroPlanner.FormatStringToReal( EditorCampaignMaxQuantity.Text() ), 0.0, true, false );
    
        LabelIndicatedDurationBasedOnMinQty.Text( indicateddurationbasedonminqty.Format( "d '" + Translations::MP_Days_Text() + "' h:m" ) );
        LabelIndicatedDurationBasedOnMaxQty.Text( indicateddurationbasedonmaxqty.Format( "d '" + Translations::MP_Days_Text() + "' h:m" ));
      } 
      else if( durationbased )
      {
        indicatedminquantity := CampaignType_MP::GetQuantityBasedOnduration( operation, GUIDurationSelectorMinDuration.Duration() );
        indicatedmaxquantity := CampaignType_MP::GetQuantityBasedOnduration( operation, GUIDurationSelectorMaxDuration.Duration() );
        LabelIndicatedQuantityBasedOnMinDuration.Text( ApplicationLibMacroPlanner.FormatRealToString( indicatedminquantity ) + ' ' + data.Unit().UnitOfMeasureName() );
        LabelIndicatedQuantityBasedOnMaxDuration.Text( ApplicationLibMacroPlanner.FormatRealToString( indicatedmaxquantity ) + ' ' + data.Unit().UnitOfMeasureName() );
      }
    }
  *]
}
