Solved

Importing a csv file using Lotusscript......103 record limit?

Posted on 2004-04-14
9
652 Views
Last Modified: 2013-12-18
Hopefully there's a simple answer to this.....I'm writing a Lotus Script procedure to open up a csv file and create a new document for each row in the file. The problem is, though, that when I run my code, Notes freezes after successfully importing 103 rows. Why does it get to 103 then give up?....it's not the file, as I've tried with different test data and it always gets to 103 then dies.
Here's the main loop in my code:

'Prompt the user for an import file
varImportFile = workspace.OpenFileDialog(False,"Please select the inventory file...","csv files|*.csv")
If Isempty(varImportFile) Then
      'No file was selected
      Exit Sub
End If

FileNum = Freefile()
Open varImportFile(0) For Input As FileNum
Do Until Eof(FileNum)
      Input #FileNum, strDateScanned ,varLocationCode ,varLocationDescription,varAssetCode ,varSerialNumber ,varDescription
      Set uidocInventory  = workspace.ComposeDocument("","", "Vendor Inventory")
      uidocInventory.FieldSetText "Vendor_ImportStatus","No Errors"
      uidocInventory.Save
      uidocInventory.Close
      Doevents
Loop

0
Comment
Question by:mrt1
[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
  • 5
  • 3
9 Comments
 
LVL 31

Accepted Solution

by:
qwaletee earned 350 total points
ID: 10825187
There are notorious problems with using the UI objects in loops.  You should be using the back end NotesDocument object instead of a UIDocument:

Dim s as new notesSession
Dim db as notesDatabase
Set db = s.currentDatabase
Dim docInventory as notesDocument
Dom counter as integer
Do Until Eof(FileNum)
     Counter = counter + 1
     Print "Getting" counter
     Input #FileNum, strDateScanned ,varLocationCode ,varLocationDescription,varAssetCode ,varSerialNumber ,varDescription
     print "Got" counter
     Set docInventory  = db.createDocument
     uidocInventory.replaceItemvalue "Form" , "Vendor Inventory" 'may need to change this to the Vendory Inventory form alias
     docInventory.replaceItemValue "Vendor_ImportStatus","No Errors"
     docInventory.Save
     Doevents
     Print "Done with" counter
Loop

I also don't know why you have a Doevents -- Notes ignored it.  Also, I don't see what you do with any of the values you input, so you obviously mucked about with SOMETHING.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10825194
it is because notes cannot open uidoc to certain limit , once this reaches max it will stop executing the code

soln, do this as backend operation and use compuewithform method to calc or fire any validations .. similar to openin uidoc and saving

~Hemanth
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10825198
The limit is the ComposeDocuments. Use New Document(db), set doc.Form="Vendor Inventory" and use doc.ComputeWithForm if you want fields to be evaluated.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10825223
Aaaargh! Sorry for repeating once again (failed to push the Refresh button once again!), it must mean we're on the right track. I'm first though with ComputeWithForm ;)

Sjef
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10825295
And even that's not true :( It's late, got a headache. Problem is solved. Bye
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10825377
sjef,  Distributing visiting cards  ?? ;-)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10830906
Grmblgrmblgrmblgrmblgrmblgrmblgrmblgrmblgrmbl...
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10833042
Is that encrypted information of your visting card ?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 10833273
No, it's my password at http://www.visitcards.org.
Help yourself, please.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

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