Solved

Import from comma delimeted text file

Posted on 2000-03-01
3
241 Views
Last Modified: 2013-12-18
Hi,

How can I easily import to a view a text file (MS Proxy Server Log File) that is comma delimeted?  It will be one document per line. And it must able to interpret Date/Time Field.


Reden
0
Comment
Question by:reden
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Expert Comment

by:Arunkumar
ID: 2572172
Hi reden,

You got to have a form for this imported documents to be viewed.

Did you try importing txt files using the notes import feature File-Import

You can specify the form and also calculate the ields on document import.

You can improve your import by writing a format file with .col extn.

Also you can import using LotusScript
one line after another and creating a document for each read.

With which one you have a problem ?

-Arun
0
 
LVL 1

Author Comment

by:reden
ID: 2575939
I already have a form, I tried File-Import Feature but it only have Tabular, Structured and Lotus 123 formats supported, If I try Tabular it goes in to a single field "Body"

How will I create a .col file?
0
 
LVL 9

Accepted Solution

by:
Arunkumar earned 50 total points
ID: 2579675
Hi reden,

This is an example i have with me....

The text File has something like this...

======================================
aruna,27,09-15-72,3000
arunb,27,09-15-72,3022
arunc,27,09-15-72,3033
arund,27,09-15-72,3044
arune,27,09-15-72,3055
arunf,27,09-15-72,3066
arunh,27,09-15-72,30546
arunf,27,09-15-72,30345
arung,27,09-15-72,30432
aruns,27,09-15-72,30445
======================================

Write a view action that will contain the following code

====================================
Dim ss As New notessession
Dim ws as new notesuiworkspace
     Dim db As notesdatabase
     Set db = ss.CurrentDatabase    
     Dim doc As notesdocument
     Dim wholetxt As String
     Dim fileNum As Integer
     Dim counter As Integer
     Dim countRec As Integer
     
     fileNum% = Freefile()
     counter% = 0
'Specify the file    
     Open "c:\windows\desktop\import.txt" For Input As fileNum%
     Do While Not Eof(fileNum%)
   ' Read each line of the file.
          Line Input #fileNum%, wholetxt$
         
          pos = Instr(1,wholetxt,",")
          firsttxt = Left(wholetxt, pos -1)
          remtxt = Right(wholetxt , Len(wholetxt) - (Len(firsttxt) + 1))
         
          pos = Instr(1,remtxt,",")
          secondtxt = Left(remtxt , pos-1)
          remtxt = Right(remtxt , Len(remtxt) - (Len(secondtxt) + 1))
         
          pos = Instr(1,remtxt,",")
          thirdtxt = Left(remtxt , pos-1)          
          remtxt = Right(remtxt , Len(remtxt) - (Len(thirdtxt) + 1))
         
'          pos = pos = Instr(1,remtxt,",")
          fourthtxt = remtxt
'          remtxt = Right(remtxt , Len(remtxt) - (Len(fourthtxt) + 1))
         
         
          Set doc = db.CreateDocument
          doc.form = "import"
          doc.NameField = firsttxt
          doc.AgeField = secondtxt
          doc.dobField = Cdat(Format(thirdtxt,"MM/DD/YYYY"))
          doc.salField = fourthtxt
          Call doc.Save(True,False)          
          Delete doc
         
   ' Increment the line count.
          counter% = counter% + 1
     Loop

call ws.viewrefresh

====================================

Some tips:
1. Make sure you give the exact filepath for the location of the file
2. Make sure that you change the datatype of the fields that you want to create on the document (This decides the datatype of the fields)
3. The code works for only 4 fields and you may extend this to "n" just by cut and pasting the logic inside

Good Luck !

-Arun

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Saving email w/ attachments using lotus notes 7 318
Lotus Notes 41 222
Peculiar IBM Lotus Notes / Cisco VPN Issue 21 938
sending email via lotus notes 8.5 using vba in access 5 571
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question