| Quintiq file version 2.0 | 
| #parent: #root | 
| Method PopulateScenarioComparisonAccountsData ( | 
|   structured[MacroPlan] macroplans, | 
|   structured[Period_MP] activePeriods, | 
|   structured[Unit] units, | 
|   structured[StockingPoint_MP] sps, | 
|   structured[Product_MP] products | 
| ) id:Method_ApplicationMacroPlanner_PopulateScenarioComparisonAccountsData | 
| { | 
|   #keys: '[138546.0.68205360]' | 
|   Body: | 
|   [* | 
|     // Populate accounts data for scenario comparison | 
|     account := DataHolderScenarioComparisonAccount.Data(); | 
|     if( not isnull( account ) ) | 
|     { | 
|       // Assign data to DataHolderGlobalParameter | 
|       gp := MacroPlan.GlobalParameters_MP(); | 
|        | 
|       owner := shadow( gp ); | 
|       accountName := account.Name(); | 
|        | 
|       accounts := selectset( macroplans,  | 
|                              Elements.Account_MP,  | 
|                              acc,  | 
|                              acc.Name() = accountName ); | 
|                             | 
|       unitIDs := selectvalues( units, Elements, e, true, e.ID() ); | 
|       spIDs := selectvalues( sps, Elements, e, true, e.ID() ); | 
|       productIDs := selectvalues( products, Elements, e, true, e.ID() ); | 
|        | 
|       uas := selectset( accounts,  | 
|                         Elements.UnitAccount,  | 
|                         ua,  | 
|                         ua.Unit().IsInUnitWeb( unitIDs ) ); | 
|                        | 
|       spas := selectset( accounts,  | 
|                              Elements.StockingPointAccount,  | 
|                              spa,  | 
|                              spa.StockingPoint_MP().IsInStockingPointWeb( spIDs ) ); | 
|                        | 
|       pispas := selectset( accounts, Elements.PISPAccount,  | 
|                                pispa, | 
|                                pispa.ProductInStockingPoint_MP().StockingPoint_MP().IsInStockingPointWeb( spIDs ) | 
|                                and pispa.ProductInStockingPoint_MP().Product_MP().IsInProductWeb( productIDs ) ); | 
|                                 | 
|       ApplicationMacroPlanner.CreateShadowAcountAssignmentInPeriodForUnitAccount( owner, uas, activePeriods ); | 
|       ApplicationMacroPlanner.CreateShadowAcountAssignmentInPeriodForStockingPointAccount ( owner, spas, activePeriods );   | 
|       ApplicationMacroPlanner.CreateShadowAcountAssignmentInPeriodForPISPAccount( owner, pispas, activePeriods ); | 
|        | 
|       // Software latest behavior, only set once to dataholder after all manipulation is done | 
|       // After storing to dataholder, subsequent manipulation will not take effect | 
|       DataHolderScenarioComparisonGlobalParameters.Data( &owner ); | 
|     } | 
|   *] | 
| } |