limj
2023-10-24 93652435728de839582440eefd5122c281181d35
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
Quintiq file version 2.0
#parent: #root
Method GetUnitsByName (
  String name_fragment
) remote as owning Units
{
  Description: 'Return a series of keys for unit instance have name matched with the given string.'
  TextBody:
  [*
    // DWE2 Jul-20-2016 (created)
    
    units := null( Units, owning );
    
    if( name_fragment <> '' )
    {
      name_fragment := name_fragment.ToLower()
      
      units := selectsortedset( this, Unit, unit, 
                                unit.Name().ToLower().FindString( name_fragment, 0 ) > -1,
                                // Sort it decending by DsiplayIndex as workaround for ScrollToSelectedElement in List
                                -unit.DisplayIndex() );                                           
    }
    
    return &units;
  *]
}