Quintiq file version 2.0 #parent: #root Method EditUnitCapacityFromListUnitPeriodQuantity ( internal[GUIComponent] parent, structured[UnitPeriodQuantity] selection ) id:Method_DialogCreateEditUnitCapacity_EditUnitCapacityFromListUnitPeriodQuantity { #keys: '[107528.0.125617852]' Body: [* // Edit the unit capacity of the selection unit period quantities from periods list isbatchedit := selection.Size() > 1; Dialog.ShowHideComponentForBatchEdit( isbatchedit, false, true ); // Need this for excluding itself in pre-condition primary keys checking. upq := selection.Element( 0 ); data := shadow( selection.Element( 0 ).UnitCapacity() ); // In case selection.Element( 0 ) doesn't bind to any unit capacity, calling SetDefaultValue method will return null error. // Check start in case of editing from UPQ later than the existing UC, the Start date will be off if we pass in existing UC if( isnull( data ) or data.Start() <> selection.Element( 0 ).Start() ) { data := selection.Element( 0 ).Unit().UnitCapacity( relshadow, UnitID := upq.Unit().ID(), Start := upq.Start() ); } Dialog.Data( data ); // Need this so that when the upt doesn't not have a unit capacity, the fields in this Dialog will not be blank. Dialog.SetDefaultValue( selection.Element( 0 ) ); result := this.DoModal( parent ); if ( result > 0 ) { UnitCapacity::CreateOrUpdateForUnitPeriodQuantitys( selection, not isbatchedit or CheckBoxBatchEditCapacity.Checked(), data.TimeUnit(), data.MinCapacity(), data.MaxCapacity(), not isbatchedit or CheckBoxBatchEditMaxLoadPercentage.Checked(), data.MaximumLoadPercentage(), not isbatchedit or CheckBoxBatchEditNrOfUnitsOpen.Checked(), data.NrOfUnitsOpen(), CheckBoxThisPeriodOnwards.Checked() ); } *] }