Quintiq file version 2.0
#parent: #root
Method UnselectUnits (
  structured[Unit] units
) id:Method_DialogUnitsForSmartPlan_UnselectUnits
{
  #keys: '[125270.0.693465005]'
  Body:
  [*
    //Unselect units
    
    //Get children
    children := selectset( units, Elements.AllChildren.AsChildren, c, true );
    parents := selectset( units, Elements.AllParent.AsParent, p, true );
    toBeMoved := children.Union( parents );
    
    //Add to unselected
    currentUnselected := DataHolderUnselectedUnitsSPD.Data();
    add := toBeMoved.Union( currentUnselected );
    DataHolderUnselectedUnitsSPD.Data( &add );
    
    //Remove from selected
    currentUnits := DataHolderSelectedUnitsSPD.Data();
    currentUnits := currentUnits.Difference( toBeMoved )
    DataHolderSelectedUnitsSPD.Data( &currentUnits );
  *]
}
