• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

I want to import address data

I am using Notes 4.6.  We have several .csv files that contain address data (the fields and field names are unique in each .csv file).  I would like to be able to import each file into my persaonl address book and into a particular category.  To further complicate matters I wuld also like the ability to either append or overwrite any data that already exists in that given category.  Is this easily doable?
  • 3
  • 2
1 Solution

You can do that by using script only, there is no other way to achieve this easily.

If I am correct are you looking for sample code.???

KubaAuthor Commented:
I guess I am looking for code or some direction.  Assuming the answer is that I can do what i want I then need to know *how* to do it.

Dear Kuba,

This can be done through scripts. First you can archive all the details in the existing address book through the archivedatabase method in lotusscript. This will archive the database(documents created with any specific forms) and then you can create a button in the address book and run an agent in the click event of the button. The agent will open the csv file and then using the input# statement of lotusscript store every value in a separate variable and then you can set doc.form to any form that you want to store the data and then create the document by using the createdocument method. You can find a good example of how to read the .csv file by looking through the notes help under the example for the "open statement". Cut and paste the example in the agent and then change the necessary details and try running it.

I have done the same task myself and it works fine. Hope you are successful in doing this.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Code to archive database

Dim archiveDb As New NotesDatabase( "", "" )
Dim doc  As NotesDocument
If ( doc.Form= "Person" ) Then
  Call doc.CopyToDatabase( archiveDb )
End If

Code for the agent that reads the csv file

Type RecType
   empId As Double
   employee As String
End Type      
Dim arrayOfRecs() As RecType
Dim txt As String
Dim fileNum As Integer
Dim counter As Integer
Dim countRec As Integer
fileNum% = FreeFile()
counter% = 0
Open "c:\My Documents\Test.csv" For Input As fileNum%
Do While Not EOF(fileNum%)
      Line Input #fileNum%, txt$
      counter% = counter% + 1
Seek fileNum%, 1
ReDim arrayOfRecs(1 To counter%)
For countRec% = 1 To counter%
   Input #fileNum%, arrayOfRecs(countRec%).employee$, _
dim newdoc as notesdocument
set newdoc=db.createdocument
call newdoc.save(true,true)
Close fileNum%
Print arrayOfRecs(2).employee$ & " " arrayOfRecs(2).empId#

Hi Kuba,

I have written the code for the agent too. All the best.
KubaAuthor Commented:
Wow that looks great!  Of course I don't understand much of it :)

I'd like to keep the question open a bit in case I have implementation problems (I assume I have to modify the script for my environment). If I don't get around to this soon I'll close out the question with this as the answer.
KubaAuthor Commented:
Answer accepted

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now