<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум компьютерной помощи &mdash; Перенос документов "связей" между базами.]]></title>
	<link rel="self" href="https://itpmr.ru/extern.php?action=feed&amp;tid=1096&amp;type=atom" />
	<updated>2021-02-01T13:46:16Z</updated>
	<generator>PunBB</generator>
	<id>https://itpmr.ru/viewtopic.php?id=1096</id>
		<entry>
			<title type="html"><![CDATA[Перенос документов "связей" между базами.]]></title>
			<link rel="alternate" href="https://itpmr.ru/viewtopic.php?pid=124800#p124800" />
			<content type="html"><![CDATA[<p>Данный агент переносит все документы связей с БД LoglinksSMI в БД Loglinks<br />Sub Click(Source As Button)<br />&nbsp; &nbsp; Dim session As New NotesSession<br />&nbsp; &nbsp; Dim ws As New NotesUIWorkspace<br />&nbsp; &nbsp; Dim db As NotesDatabase<br />&nbsp; &nbsp; Dim db2 As NotesDatabase<br />&nbsp; &nbsp; Dim view As NotesView, view2 As notesview<br />&nbsp; &nbsp; Dim dc As NotesDocumentCollection<br />&nbsp; &nbsp; Dim curdoc As NotesDocument, doc As NotesDocument, ftdoc As NotesDocument, newdoc As NotesDocument<br />&nbsp; &nbsp; Dim nextdoc As NotesDocument<br />&nbsp; &nbsp; Dim item As NotesItem, item2 As NotesItem, item3 As NotesItem<br />&nbsp; &nbsp; Dim server As String, formula As String, str1 As String<br />&nbsp; &nbsp; Dim i As Variant<br />&nbsp; &nbsp; i=0<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; On Error Goto ErrH<br />&nbsp; &nbsp; server=session.CurrentDatabase.Server<br />&nbsp; &nbsp; Set db=session.GetDatabase(server,&quot;promdoc\LoglinksSMI.nsf&quot;)<br />&nbsp; &nbsp; Set db2=session.GetDatabase(server,&quot;promdoc\Loglinks.nsf&quot;)<br />&nbsp; &nbsp; Set curdoc=ws.CurrentDocument.Document<br />&nbsp; &nbsp; Set view=db.GetView(&quot;connect&quot;)<br />&nbsp; &nbsp; Set doc=view.GetFirstDocument<br />&nbsp; &nbsp; While Not doc Is Nothing<br />&nbsp; &nbsp; &nbsp; &nbsp; Print doc.header(0)<br />&nbsp; &nbsp; &nbsp; &nbsp; If&nbsp; doc.whois(0) = &quot;В архиве&quot;&nbsp; Then<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; doc.BASE_NAME = &quot;promdoc\documentsSMI.nsf&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; Else<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Print doc.whois(0)<br />&nbsp; &nbsp; &nbsp; &nbsp; End If<br />&nbsp; &nbsp; &nbsp; &nbsp; doc.Serv_name =&quot;MIITK&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; doc.ADDREADERS=Arrayunique(doc.ADDREADERS)<br />&nbsp; &nbsp; &nbsp; &nbsp; doc.USER =&quot;SMI&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; Call doc.Save(True, False)<br />&nbsp; &nbsp; &nbsp; &nbsp; Print &quot;Сохранили&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; Set newdoc=db2.CreateDocument&nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; Call doc.CopyAllItems(newdoc,1)<br />&nbsp; &nbsp; &nbsp; &nbsp; newdoc.UniversalID=doc.UniversalID<br />&nbsp; &nbsp; &nbsp; &nbsp; Call newdoc.ComputeWithForm(0,0)<br />&nbsp; &nbsp; &nbsp; &nbsp; Call newdoc.Save(True,False)<br />&nbsp; &nbsp; &nbsp; &nbsp; Print &quot;Создали новый&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; Set nextdoc = view.getnextdocument(doc)<br />&nbsp; &nbsp; &nbsp; &nbsp; Set doc=nextdoc<br />&nbsp; &nbsp; &nbsp; &nbsp; Set nextdoc=Nothing<br />&nbsp; &nbsp; &nbsp; &nbsp; i=i+1<br />&nbsp; &nbsp; &nbsp; &nbsp; Print Cstr(i)<br />&nbsp; &nbsp; &#039;&nbsp; &nbsp; If i = 2 Then Exit Sub<br />&nbsp; &nbsp; Wend<br />&nbsp; &nbsp; Msgbox &quot;Замена&nbsp; прошла успешно&quot;<br />&nbsp; &nbsp; Exit Sub<br />ErrH:<br />&nbsp; &nbsp; Msgbox &quot;Ошибка&nbsp; &quot; &amp; Error(Err) &amp; &quot; в строке &quot; &amp; Erl&nbsp; &nbsp; <br />&nbsp; &nbsp; Exit Sub<br />End Sub</p>]]></content>
			<author>
				<name><![CDATA[admin]]></name>
				<uri>https://itpmr.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-02-01T13:46:16Z</updated>
			<id>https://itpmr.ru/viewtopic.php?pid=124800#p124800</id>
		</entry>
</feed>
