Quintiq file version 2.0
|
#parent: #root
|
Method SetDefaultDisplayIndexForUnit
|
{
|
Description: 'Set default display index for unit'
|
TextBody:
|
[*
|
// Level-order traversal of Unit hierarchy
|
// Start with root units, sorted by name
|
queue := selectsortedset( this, Unit, unit, isnull( unit.Parent() ), unit.Name() );
|
i := 0;
|
while( queue.Size() > 0 )
|
{
|
// Get leading unit
|
unit := queue.Element( 0 );
|
unit.DisplayIndexForExcel( i );
|
i++;
|
|
// Add child units to the queue, sorted by name
|
childunits := selectsortedset( unit, Child, child, true, child.Name() );
|
traverse( childunits, Elements, child )
|
{
|
queue.Add( child );
|
}
|
// Remove leading unit from queue
|
queue.Remove( unit );
|
}
|
*]
|
}
|