Quintiq file version 2.0
#parent: #root
Method DeleteKB () id:Method_FormKBManagement_DeleteKB
{
  #keys: '[11660.0.86509068]'
  Body:
  [*
    //delete kb
    strings := StringListKnowledgeBase.GetSelectedLine().Tokenize( ':');
    
    if (strings.Size() = 4 )
    {
      name := strings.Element( 0 );
      branch := strings.Element( 1 );
      changenr := strings.Element( 2) ;
    
      editor := CKBEditor::Create();
      kb := select( MacroPlan.MDSMacroPlan(), MDSKBs, kbs, true, true);
    
      kbid := KBID::Create( kb.Domain(), name );
      kbinfos  := editor.GetKBStructure( kbid );
    
      kbfullid := select( kbinfos, Elements.KBFullID, e, e.Name() = name and e.Branch() = branch and e.ChangeNr() = [Number]changenr );
      editor.DeleteKBChange( kbfullid );
    
      FormKBManagement.UpdateKBList();
    }
    else
    {
      error('The selected KB row has incorrect Name, Branch, Version or ChangeNr.');
    }
  *]
}
