Quintiq file version 2.0
#parent: #root
Method CanDelete () as String id:Method_FormKBManagement_CanDelete
{
  #keys: '[11660.0.90540992]'
  Body:
  [*
    //Check whether KB can be deleted
    feedback := '';
    
    strings := StringListKnowledgeBase.GetSelectedLine().Tokenize( ':');
    if (strings.Size() = 0 )
    {
      feedback := 'No record is selected'
    }
    else if (strings.Size() = 4 )
    {
      name := strings.Element( 0 );
      branch := strings.Element( 1 );
      inuse := strings.Element( 3 );
    
      if (name = ScenarioManager.CompanyKBName() and branch = GlobalParameters_MP::GetKB() )
      {
        feedback := 'Cannot delete the default knowledgebase instance, name=' + ScenarioManager.CompanyKBName() + ', branch=KB'
      }
      else if ( [Number]inuse > 0 )
      {
        feedback := 'This KB is in use by other scenarios. Some of the scenarios may not be visible to this usergroup.';
      }
    
    }
    
    return feedback;
  *]
}
