lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Quintiq file version 2.0
#parent: #root
StaticMethod CreateForRun (LibOpt_Run run, Boolean isabsolute) as LibOpt_StatisticTimeTotal
{
  Description: 'Create a `LibOpt_StatisticTimeTotal` instance for the given "run" (`LibOpt_Run`), which collects time values on the \'Run\' level.'
  TextBody:
  [*
    statistictime := LibOpt_StatisticTime::Create( run, typeof( LibOpt_StatisticTimeTotal ),
                                                   'Run ' +  run.RunNr().AsQUILL(),
                                                   /*
                                                     - Link the Run-level time statistic with the `StartComponent` of the "run".
                                                     - This workaround is to facilitate the display of Statistics when we apply
                                                       filtering based on the selection of a particular Component.
                                                     - With this relation set, the Statistic will be displayed when the
                                                       `StartComponent` of the "run" is selected.
                                                   */
                                                   run.StartComponent(),          // Component
                                                   null( LibOpt_StatisticTime ),  // Parent
                                                   false, // Is component
                                                   false, // Is type
                                                   isabsolute
                                                 ).astype( LibOpt_StatisticTimeTotal );
    
    // Set root-specific relation.
    statistictime.AsStatisticTimeTotalRun( relset, run );
    
    return statistictime;
  *]
}