Quintiq file version 2.0
#parent: #root
Method DeletePreviousKBChange (
  String branch,
  Number changenr
) id:Method_ApplicationLibMacroPlanner_DeletePreviousKBChange
{
  #keys: '[11660.0.605427882]'
  Body:
  [*
    // Delete previous KB change
    editor := CKBEditor::Create();
    
    kb := select( MacroPlan.MDSMacroPlan(), MDSKBs, kb, kb.Name() = ScenarioManager.CompanyKBName() and kb.Branch() = branch );
    kbfullid := KBFullID::Create( kb.Domain(), kb.Name(), kb.Branch(), kb.Version(), kb.ChangeNr() );
    
    editor.DeleteAllButLatestKBChange( kbfullid );
  *]
}
