Quintiq file version 2.0
#parent: #root
Method InitializeDataHolders (
  structured[UnitPeriodQuantity] selection
) id:Method_DialogCreateEditQuantityCapacity_InitializeDataHolders
{
  #keys: '[151892.0.52066161]'
  Body:
  [*
    //Initialize dataholders
    firstElement := minselect( selection, Elements, e, true, e.Start() );
    data := shadow( firstElement.UnitCapacity() );
    
    if( isnull( data )
        or data.Start() <> firstElement.Start() )
    {
      data := firstElement.Unit().UnitCapacity( relshadow,
                                                UnitID := firstElement.Unit().ID(),
                                                Start := firstElement.Start(),
                                                TimeUnit := firstElement.TimeUnitForCapacitiesCalculation(),
                                                MinCapacity := firstElement.MinCapacityPerTimeUnit(),
                                                MaxCapacity := firstElement.MaxCapacityPerTimeUnit(),
                                                MaximumLoadPercentage := firstElement.MaximumLoadPercentage(),
                                                NrOfUnitsOpen := firstElement.NrOfOpen()
                                               );
    }
    
    
    DataHolderDialogData.Data( &data );
    DataHolderDialogDatas.Data( selection.Copy() );
    
    this.InitializeComponents(); 
    
    ApplicationMacroPlanner.ShowFormModal( this );
  *]
}
