Domino Code Fragment

Code Name*
Importing text file into notes using Lotus Script
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.144.193.129
Description*
Create a price list in notes from a comma separated file. Each line was one document.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
  Dim session As New NotesSession
    Dim db As NotesDatabase
     Dim doc As NotesDocument
   
    Dim fileNum As Integer
    Dim fileName As String
   
    Set db = session.CurrentDatabase
    Set doc = New notesdocument(db)
   
    FileNum% = Freefile()
    FileName$ = "c:\CSCDocs\price.txt"
    Open FileName$ For Input As FileNum%
' first line is header with price table info    
    Input #FileNum%,PriceName,ProductCode,ProductPrice,ProductMaint,ProductName,ProductCost,ProductSort,ProductDesc
    margin = ProductPrice    
   
    Do While Not Eof(FileNum%)
         Input #FileNum%,PriceName,ProductCode,ProductPrice,ProductMaint,ProductName,ProductCost,ProductSort,ProductDesc
         Set doc = New notesdocument(db)
         ProductLine = "MHC"
         
         Select Case ProductSort
         Case Is < 30000
              Cat = "Software"
         Case Is < 37000
              Cat = "CSIM/EDA"
         Case Is < 40000
              Cat = "Universe"
         Case Is < 50000

               Cat = "System Builder"
         Case Is < 60000
              Cat = "Terminal Emulation"
         Case Is < 80000
              Cat = "DIVA"
         Case Else
              Cat = "General Products"
         End Select
         
         doc.form = "ProdServ"
         doc.ProductLine = ProductLine
         
         doc.Category = Cat
         doc.StatusFlag = "Active"
         doc.CostPercent = margin
         doc.ProductCode = ProductCode
         doc.Retail = ProductPrice
         doc.cost = ProductCost
         doc.SupportFee = ProductMaint          
         doc.ProductName = ProductName
         doc.SortID = ProductSort
         doc.ProductDesc = ProductDesc
         Call doc.save(True,False)
    Loop
   
    Close FileNum%