Solved

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

Posted on 2004-04-14
9
621 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
 
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

744 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

15 Experts available now in Live!

Get 1:1 Help Now