Quintiq file version 2.0
#parent: #root
Method UpdateToggledButtons (
  String button
) id:Method_ApplicationMacroPlanner_UpdateToggledButtons
{
  #keys: '[139394.0.105445237]'
  Body:
  [*
    // Update toggled button string dataholder
    // Since dataholder cannot store strings
    // need to parse the String into Strings 
    // for efficient comparison
    delimiter := SupplyChainSelection::GetDelimiter();
    toggledbuttons := DataHolderToggledButtons.Data().Tokenize( delimiter );
    
    isexisted := false
    for( i := 0; i < toggledbuttons.Size(); i++ )
    {
      if( toggledbuttons.Element( i ) = button )
      {
        toggledbuttons.Delete( i );
        isexisted := true;
      }
    }
    
    if( not isexisted )
    {
      toggledbuttons.Add( button );
    }
    
    DataHolderToggledButtons.Data( toggledbuttons.ToString( delimiter ) );
  *]
}
