Database

dear friends,i have two file.

the first file named “databaseA.nsf”. inside that there is a form named “frmA”. in the form there is field named “fieldA” and an action button named “copy”.

the first file named “databaseB.nsf”. inside that there is a form named “frmB”. in the form there is field named “fieldB”.

my question is : i want to copy “fieldA” to “fieldB”.

thanx for answering my question

Subject: database

assume docA is frmA, docB is frmB

docB.fieldB=docA.fieldA

Subject: database

Hi

Do you mean that you want to copy the value of field A on a particular document in database A to field B on a document in database B?

If so, do you know how the copy button can find document B - is there some sort of key that links them?

If you can give a little more info, we can help you better.

On the whole, Lotusscript is your best option, and you’d use something along the lines of:

Dim ws as new notesuiworkspace

Dim docA as notesDocument

Dim docB as notesDocument

Dim s as new notessession

Dim dbA as notesdatabase

Dim dbB as notesdatabase

set dbA = s.currentDatabase

set dbB = s.getDatabase(dbA.server, “databaseB.nsf”)

set docA = ws.currentDocument.document

’ ===== Need code here to set docB ===== ’

’ == Probably use a view in database B = ’

’ == For example: ====================== ’

Dim vwB as notesView

set vwB = dbB.getView(“DocLookup”)

set docB = vwB.getDocumentByKey(docA.keyValue(0), true)

’ ======================================= ’

If not docB is nothing then

docB.fieldB = docA.fieldA

call docB.save(true, true)

Else

Error 4, “unable to find destination document”

End If

The code I used to find docB relies on the following:

  1. docA has a field called “keyValue” which contains the value used to locate docB. docB should also contain this value in a similar field

  2. database B contains a view called docLookup in which the first sorted column contains the value of docB’s keyValue

If you have a different way of linking the documents, just swap out that section of code.

HTH

Kiers