 




<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Copying form field data from one database to another</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/</link>
	<description></description>
	<lastBuildDate>Sat, 25 May 2013 10:29:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: ledlincoln</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/#comment-62717</link>
		<dc:creator>ledlincoln</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:13:22 +0000</pubDate>
		<guid isPermaLink="false">#comment-62717</guid>
		<description><![CDATA[Erratum: The forum &quot;helpfully&quot; converted &quot;session.Co_mmonUserName&quot; to a session.com weblink in the line with the Authors field.

Call newdoc.ReplaceItemValue(&quot;Authors&quot;, session.Com&quot; title=&quot;http://Session. &quot; target=&quot;_blank&quot;&gt;Session.Com&lt;/a&gt;monUserName)]]></description>
		<content:encoded><![CDATA[<p>Erratum: The forum &#8220;helpfully&#8221; converted &#8220;session.Co_mmonUserName&#8221; to a session.com weblink in the line with the Authors field.</p>
<p>Call newdoc.ReplaceItemValue(&#8220;Authors&#8221;, session.Com&#8221; title=&#8221;http://Session. &#8221; target=&#8221;_blank&#8221;&gt;Session.Com&lt;/a&gt;monUserName)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ledlincoln</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/#comment-62714</link>
		<dc:creator>ledlincoln</dc:creator>
		<pubDate>Fri, 24 Apr 2009 15:28:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-62714</guid>
		<description><![CDATA[Okay, I have copied specific lists of fields in many situations.  Here&#039;s one example, essentially verbatim:
&lt;pre&gt;
Sub copyReq
	Dim fieldlist(15) As String
	fieldlist(0) = &quot;SuggVendor&quot;
	fieldlist(1) = &quot;SuggVendorName&quot;
	fieldlist(2) = &quot;SuggVendorPhone&quot;
	fieldlist(3) = &quot;DeliverTo&quot;
	fieldlist(4) = &quot;LineItemCount&quot;
	fieldlist(5) = &quot;Quantities&quot;
	fieldlist(6) = &quot;Units&quot;
	fieldlist(7) = &quot;VendorPartNos&quot;
	fieldlist(8) = &quot;PartNos&quot;
	fieldlist(9) = &quot;UnitPrices&quot;
	fieldlist(10) = &quot;ExtPrices&quot;
	fieldlist(11) = &quot;Descriptions&quot;
	fieldlist(12) = &quot;Comments&quot;
	fieldlist(13) = &quot;Readers&quot;
	fieldlist(14) = &quot;ReqDescription&quot;
	fieldlist(15) = &quot;Prototypes&quot;
	
	Set collection = db.UnprocessedDocuments
	Let cc% = collection.Count
	If cc% &lt;&gt; 1 Then
		Msgbox &quot;You must select only one req to copy&quot;, , &quot;Select One Req&quot;
		Exit Sub
	End If
	Set thisdoc = collection.GetFirstDocument
	
	Dim newdoc As New NotesDocument(db)
	Call newdoc.ReplaceItemValue(&quot;Form&quot;, &quot;New Req&quot;)
	Call newdoc.ReplaceItemValue(&quot;Status&quot;, &quot;New - Not Submitted&quot;)
	Call newdoc.ReplaceItemValue(&quot;Authors&quot;, Session.CommonUserName)
	For f% = 0 To Ubound(fieldlist)
		Set item = thisdoc.GetFirstItem(fieldlist(f%))
		If Not (item Is Nothing) Then
			Call newdoc.CopyItem(item, &quot;&quot;)
		End If
	Next f%
	
	Call workspace.EditDocument(True, newdoc)
End Sub
&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>Okay, I have copied specific lists of fields in many situations.  Here&#8217;s one example, essentially verbatim:</p>
<pre>
Sub copyReq
	Dim fieldlist(15) As String
	fieldlist(0) = "SuggVendor"
	fieldlist(1) = "SuggVendorName"
	fieldlist(2) = "SuggVendorPhone"
	fieldlist(3) = "DeliverTo"
	fieldlist(4) = "LineItemCount"
	fieldlist(5) = "Quantities"
	fieldlist(6) = "Units"
	fieldlist(7) = "VendorPartNos"
	fieldlist(8) = "PartNos"
	fieldlist(9) = "UnitPrices"
	fieldlist(10) = "ExtPrices"
	fieldlist(11) = "Descriptions"
	fieldlist(12) = "Comments"
	fieldlist(13) = "Readers"
	fieldlist(14) = "ReqDescription"
	fieldlist(15) = "Prototypes"
	
	Set collection = db.UnprocessedDocuments
	Let cc% = collection.Count
	If cc% &lt;&gt; 1 Then
		Msgbox "You must select only one req to copy", , "Select One Req"
		Exit Sub
	End If
	Set thisdoc = collection.GetFirstDocument
	
	Dim newdoc As New NotesDocument(db)
	Call newdoc.ReplaceItemValue("Form", "New Req")
	Call newdoc.ReplaceItemValue("Status", "New - Not Submitted")
	Call newdoc.ReplaceItemValue("Authors", Session.CommonUserName)
	For f% = 0 To Ubound(fieldlist)
		Set item = thisdoc.GetFirstItem(fieldlist(f%))
		If Not (item Is Nothing) Then
			Call newdoc.CopyItem(item, "")
		End If
	Next f%
	
	Call workspace.EditDocument(True, newdoc)
End Sub
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: greendbend</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/#comment-62670</link>
		<dc:creator>greendbend</dc:creator>
		<pubDate>Thu, 23 Apr 2009 19:57:47 +0000</pubDate>
		<guid isPermaLink="false">#comment-62670</guid>
		<description><![CDATA[Thank you everyone for all of your suggestions. 

Ledlincoln, as for creating a new document each time in database two, yes that is my intention. However, I only want to copy the data from a select number of fields in the form on database one to the database two.

I have been successful in opening database two from database one and creating the designated form in database one. My issue still lies with copying the data from the specific fields, as I don&#039;t want everything copied.]]></description>
		<content:encoded><![CDATA[<p>Thank you everyone for all of your suggestions. </p>
<p>Ledlincoln, as for creating a new document each time in database two, yes that is my intention. However, I only want to copy the data from a select number of fields in the form on database one to the database two.</p>
<p>I have been successful in opening database two from database one and creating the designated form in database one. My issue still lies with copying the data from the specific fields, as I don&#8217;t want everything copied.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ledlincoln</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/#comment-62411</link>
		<dc:creator>ledlincoln</dc:creator>
		<pubDate>Fri, 17 Apr 2009 19:02:02 +0000</pubDate>
		<guid isPermaLink="false">#comment-62411</guid>
		<description><![CDATA[If it&#039;s your intention to create a new document in Database Two each time, take a look at the CopyToDatabase method.

Set newNotesDocument = notesDocument.CopyToDatabase(notesDatabase)

The code would be something like this:

Dim workspace as New NotesUIWorkspace
Dim uidoc as NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim db2 as NotesDatabase
Set db2 = New NotesDatabase(&quot;ServerName&quot;, &quot;FileName&quot;)
Dim thisdoc as NotesDocument
Set thisdoc = uidoc.Document
Dim newdoc as NotesDocument
Set newdoc = thisdoc.CopyToDatabase(db2)]]></description>
		<content:encoded><![CDATA[<p>If it&#8217;s your intention to create a new document in Database Two each time, take a look at the CopyToDatabase method.</p>
<p>Set newNotesDocument = notesDocument.CopyToDatabase(notesDatabase)</p>
<p>The code would be something like this:</p>
<p>Dim workspace as New NotesUIWorkspace<br />
Dim uidoc as NotesUIDocument<br />
Set uidoc = workspace.CurrentDocument<br />
Dim db2 as NotesDatabase<br />
Set db2 = New NotesDatabase(&#8220;ServerName&#8221;, &#8220;FileName&#8221;)<br />
Dim thisdoc as NotesDocument<br />
Set thisdoc = uidoc.Document<br />
Dim newdoc as NotesDocument<br />
Set newdoc = thisdoc.CopyToDatabase(db2)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sliktool</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/#comment-62380</link>
		<dc:creator>sliktool</dc:creator>
		<pubDate>Fri, 17 Apr 2009 12:13:57 +0000</pubDate>
		<guid isPermaLink="false">#comment-62380</guid>
		<description><![CDATA[There is a way to do this both in LotusScript and Formula.  If you use Formula you must do the work from within the 2nd database though.  I should mention that one detail missing from your explanation is whether this is suppose to be an automatic process or user triggered.  This explanation assumes that a user is involved.  If it is suppose to be automatic then a change is necessary.  These examples assume that a user working in the 2nd database will open a document based on form2 and the contents will be populated by the values on a document created by form1 in the 1st database.

@Formula:

In the Form on the second database use the @DBLookup formula to compute each field on the (or the default value) form.  This is somewhat inefficient though.  Nonetheless, it will work.  This means the documents created by the form in the 1st database need to be in a view and retrievable by a key.  Hence a possible &quot;issue&quot;, how does the 2nd database know the key?  You could do some work with @DBColumn for this - but it gets a little &quot;kluggy&quot; without user interaction.  I would suggest having 1 field on the new form in the 2nd database be a dialog list/combo box that derives its values from the @DBColumn of the first column in the 1st database.  When the user chooses a value from the list, then the rest of the fields populate using @DBLookup and this value as the key.  This means the key on the document in the 1st database needs to be unique for each document.  Make sense?

Lotus Script:
Using LScript for this solution is easier from a coding standpoint - however picking the when and where is more of a challenge.  As an example, you could use the same scenario as above where a dialog list/combo box field uses a @DBColumn to get the keys of documents available in the 1st database, then on the change of the value of that field, a form refresh occurs and the following code get put in the QueryRecalc event - of course this code will run every time the QueryRecalc event is triggered so it may not be the best place to do it.

Dim session  as New NotesSession
Dim seconddb as NotesDatabase
Dim secondview as NotesView
Dim seconddoc as NotesDocument
Dim keyVal as string

&#039;server name and file paths are string, enter them between double quotes
Set seconddb = New NotesDatabase( serverName$, filePath$)

&#039;view name is a string enter it between double quotes, if there is an alias, use it instead of the name
&#039;remember the first column in that view must be sorted one way or the other for this to work
Set secondview = seconddb.getview( viewName$ )

&#039;source is the current UI doc and is already set by the QueryRecalc event - no DIM required
&#039;comboboxfield$ is a string, enter name of field between double quotes
keyVal = source.fieldgettext(comboboxField$)

Set seconddoc = secondview.getdocumentbykey( keyVal, true )

forall i in seconddoc.items
call source.fieldsettext( i.name, i.values(0) )

end forall

This was not tested, but should work or be close enough to finish it up.]]></description>
		<content:encoded><![CDATA[<p>There is a way to do this both in LotusScript and Formula.  If you use Formula you must do the work from within the 2nd database though.  I should mention that one detail missing from your explanation is whether this is suppose to be an automatic process or user triggered.  This explanation assumes that a user is involved.  If it is suppose to be automatic then a change is necessary.  These examples assume that a user working in the 2nd database will open a document based on form2 and the contents will be populated by the values on a document created by form1 in the 1st database.</p>
<p>@Formula:</p>
<p>In the Form on the second database use the @DBLookup formula to compute each field on the (or the default value) form.  This is somewhat inefficient though.  Nonetheless, it will work.  This means the documents created by the form in the 1st database need to be in a view and retrievable by a key.  Hence a possible &#8220;issue&#8221;, how does the 2nd database know the key?  You could do some work with @DBColumn for this &#8211; but it gets a little &#8220;kluggy&#8221; without user interaction.  I would suggest having 1 field on the new form in the 2nd database be a dialog list/combo box that derives its values from the @DBColumn of the first column in the 1st database.  When the user chooses a value from the list, then the rest of the fields populate using @DBLookup and this value as the key.  This means the key on the document in the 1st database needs to be unique for each document.  Make sense?</p>
<p>Lotus Script:<br />
Using LScript for this solution is easier from a coding standpoint &#8211; however picking the when and where is more of a challenge.  As an example, you could use the same scenario as above where a dialog list/combo box field uses a @DBColumn to get the keys of documents available in the 1st database, then on the change of the value of that field, a form refresh occurs and the following code get put in the QueryRecalc event &#8211; of course this code will run every time the QueryRecalc event is triggered so it may not be the best place to do it.</p>
<p>Dim session  as New NotesSession<br />
Dim seconddb as NotesDatabase<br />
Dim secondview as NotesView<br />
Dim seconddoc as NotesDocument<br />
Dim keyVal as string</p>
<p>&#8216;server name and file paths are string, enter them between double quotes<br />
Set seconddb = New NotesDatabase( serverName$, filePath$)</p>
<p>&#8216;view name is a string enter it between double quotes, if there is an alias, use it instead of the name<br />
&#8216;remember the first column in that view must be sorted one way or the other for this to work<br />
Set secondview = seconddb.getview( viewName$ )</p>
<p>&#8216;source is the current UI doc and is already set by the QueryRecalc event &#8211; no DIM required<br />
&#8216;comboboxfield$ is a string, enter name of field between double quotes<br />
keyVal = source.fieldgettext(comboboxField$)</p>
<p>Set seconddoc = secondview.getdocumentbykey( keyVal, true )</p>
<p>forall i in seconddoc.items<br />
call source.fieldsettext( i.name, i.values(0) )</p>
<p>end forall</p>
<p>This was not tested, but should work or be close enough to finish it up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: greendbend</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/#comment-62338</link>
		<dc:creator>greendbend</dc:creator>
		<pubDate>Thu, 16 Apr 2009 15:54:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-62338</guid>
		<description><![CDATA[I realize now that I was not providing details on what I am proposing to do using the formulas. So, here are the details:

1.  From database one, open the form 
2.  Fill in the details on the form (approximately 20 fields).
3.  Save the form. 
4.  From within the database one form, click on a button to open database two.
5.  Open the database two form.
3.  Copy contents of the 20 fields from database one to database two.
4.  Save and close both forms.

Note:  neither database is using mail in our mail out functions.

If someone has an easy way to do this via formulas, or even better a step by step process for LotusScript, I would forever be in your debt.

Hopelessly lost...]]></description>
		<content:encoded><![CDATA[<p>I realize now that I was not providing details on what I am proposing to do using the formulas. So, here are the details:</p>
<p>1.  From database one, open the form<br />
2.  Fill in the details on the form (approximately 20 fields).<br />
3.  Save the form.<br />
4.  From within the database one form, click on a button to open database two.<br />
5.  Open the database two form.<br />
3.  Copy contents of the 20 fields from database one to database two.<br />
4.  Save and close both forms.</p>
<p>Note:  neither database is using mail in our mail out functions.</p>
<p>If someone has an easy way to do this via formulas, or even better a step by step process for LotusScript, I would forever be in your debt.</p>
<p>Hopelessly lost&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mrainer</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/#comment-62306</link>
		<dc:creator>mrainer</dc:creator>
		<pubDate>Wed, 15 Apr 2009 21:43:41 +0000</pubDate>
		<guid isPermaLink="false">#comment-62306</guid>
		<description><![CDATA[If you want to copy a document from one database to another, the only way that I have found to do this is formula is to mail it to the new database.

It&#039;s not hard to do in script.  

But maybe you are trying to copy just a few fields from a document in one database to the form in another.]]></description>
		<content:encoded><![CDATA[<p>If you want to copy a document from one database to another, the only way that I have found to do this is formula is to mail it to the new database.</p>
<p>It&#8217;s not hard to do in script.  </p>
<p>But maybe you are trying to copy just a few fields from a document in one database to the form in another.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ledlincoln</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/copying-form-field-data-from-one-database-to-another/#comment-62178</link>
		<dc:creator>ledlincoln</dc:creator>
		<pubDate>Mon, 13 Apr 2009 15:02:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-62178</guid>
		<description><![CDATA[Your question is not clear.  Are you copying a form or a document or numerous documents?  Are you copying data or design elements?  Is this a one-time thing, or a recurring need?

In many cases, the Windows copy and paste features work great for Notes, but again, it depends on what you are trying to accomplish.]]></description>
		<content:encoded><![CDATA[<p>Your question is not clear.  Are you copying a form or a document or numerous documents?  Are you copying data or design elements?  Is this a one-time thing, or a recurring need?</p>
<p>In many cases, the Windows copy and paste features work great for Notes, but again, it depends on what you are trying to accomplish.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.062 seconds using memcached
Object Caching 366/369 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-25 10:52:03 -->