const
  ClinicID=1;
var
  DbCfgFn,IdLstFn,FullRenumFn,RenumFn,Cmd: string;
begin
  {Get VisiQuick database configuration file}
  DbCfgFn:=GetDbCfgFnFromVqWorkDir('');
  {Dump image ID's to file}
  IdLstFn:=GenerateTempFn;
  Cmd:='FindWrongSoData /db="'+DbCfgFn+'" /out='+'"'+IdLstFn+'" /clinic='+IntToStr(ClinicID);
  ExecUtilsProc(Cmd);
  {Patch SO data}
  Cmd:='DeleteSoData /db="'+DbCfgFn+'" /images="'+IdLstFn+'"';
  ExecUtilsProc(Cmd);
end.
