[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 676
  • Last Modified:

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

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
mrt1
Asked:
mrt1
  • 5
  • 3
1 Solution
 
qwaleteeCommented:
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
 
HemanthaKumarCommented:
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
 
Sjef BosmanGroupware ConsultantCommented:
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!

 
Sjef BosmanGroupware ConsultantCommented:
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
 
Sjef BosmanGroupware ConsultantCommented:
And even that's not true :( It's late, got a headache. Problem is solved. Bye
0
 
HemanthaKumarCommented:
sjef,  Distributing visiting cards  ?? ;-)
0
 
Sjef BosmanGroupware ConsultantCommented:
Grmblgrmblgrmblgrmblgrmblgrmblgrmblgrmblgrmbl...
0
 
HemanthaKumarCommented:
Is that encrypted information of your visting card ?
0
 
Sjef BosmanGroupware ConsultantCommented:
No, it's my password at http://www.visitcards.org.
Help yourself, please.
0

Featured Post

Industry Leaders: 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!

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