Quintiq file version 2.0 #parent: #root Method SetDefaultValue ( StockingPointInPeriod stockingpointinperiod ) id:Method_DialogCreateEditStockingPointCapacity_SetDefaultValue { #keys: '[107528.0.125967459]' Body: [* // Set the default value for the fields in the dialog. data := Dialog.Data(); start := MacroPlan.Start().Date(); maxcapacity := 0.0; if( not isnull( stockingpointinperiod ) ) { // To inherit the value from last sp capacity while creating a new sp capacity stockingpointcapacity := stockingpointinperiod.StockingPointCapacity(); start := stockingpointinperiod.Start().Date(); if( not isnull( stockingpointcapacity ) ) { maxcapacity := stockingpointcapacity.MaxCapacity(); } else { maxcapacity := stockingpointinperiod.MaxCapacity(); } } // Assigning value to Read-Only attribute will result in runtime error. if( isnull( data.WrappedInstance() ) ) { data.Start( start ); } data.MaxCapacity( maxcapacity ); // In the case that the default stocking point cannot be found in the list of available stocking points, // the UOM should use the the currently selected stocking point's UOM // In order to set the UOM, we need to set the Dialog.Data's stocking point during initialization of the dialog availablestockingpoints := DataHolderChildStockingPoints.Data(); if( not exists( availablestockingpoints, Elements, sp, sp = data.StockingPoint_MP() ) ) { stockingpoint := availablestockingpoints.Element( 0 ); data.StockingPoint_MP( relset, stockingpoint ); } *] }