Solved

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

Posted on 2004-04-14
9
637 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
  • 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

815 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now