I have a problem I need to solve by the first of April and I was wondering If anyone have run into this. The problem is to Import an Excel speedsheet into a Domino form. I have do this by simply converting the Excel into a 1-2-3 (.wk3) and this works well.
The problem is the script running in the WebQuerySave. Since the import cannot be done on the web. I have to figure out some way to run the script when importing the speedsheet. The script generates a Request Number (unique of course) if the document is new. If the document is not new, then a mail message is sent notifing the person of updates to the form.
Here is the script
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Set db = session.CurrentDatabase
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
'check for new document
If Not(doc.IsNewNote) Then
Goto send_notice
End If
Set view = db.GetView("($Numbergen)")
NumberGen:
Dim Prevdoc As NotesDocument
Set Prevdoc = view.GetFirstDocument
Dim CurrentNo As Variant
Dim strSeq, tempseq As String
If Not(Prevdoc Is Nothing) Then
CurrentNo = Prevdoc.GetItemValue("RequestNo")
Else
CurrentNo = "0000000"
End If
If(Isarray(CurrentNo)) Then
tempseq = CurrentNo(0)
Else
tempseq = CurrentNo
End If
strSeq=Trim$(Str(Val(Right$(tempseq,3))+1))
If((Val(strSeq) > 0) And (Val(strSeq)<10)) Then
strSeq = Trim$("0000000" & strSeq)
Goto AssignNumber
End If
If ((Val(strSeq) >= 10 And Val(strSeq) < 100)) Then
strSeq = Trim("000000" & strSeq)
Goto AssignNumber
End If
If ((Val(strSeq) >= 100 And Val(strSeq) < 1000)) Then
strSeq = Trim("00000" & strSeq)
Goto AssignNumber
End If
If ((Val(strSeq) >= 1000 And Val(strSeq) < 10000)) Then
strSeq = Trim("0000" & strSeq)
Goto AssignNumber
End If
AssignNumber:
Number = Trim(strSeq)
doc.RequestNo = Number
Call doc.Save(True,False)
send_notice:
previous_assignedemail = doc.GetItemValue("previous_assignedemail")
assigned_to_email = doc.GetItemValue("assingned_email")
If previous_assignedemail(0) = assigned_to_email(0) Then
Exit Sub
End If
issue = doc.GetItemValue("issue")
docid = doc.GetItemValue("docid")
current_user = doc.GetItemValue("remote_user")
doc.previous_assignedemail = doc.assingned_email
Call doc.Save(True, False)
msg2 = "Request No: " + doc.RequestNo(0) + Chr(10) + Chr(10) + "Name: " + doc.first_name(0) + " " + doc.last_name(0)
msg2a = "Company: " + doc.company(0) + Chr(10) +"Phone No: " + doc.phone(0) + Chr(10) + "E-Mail: " + doc.email(0)
msg3 = "Inquiry: " + doc.inquiry(0) + Chr(10) + "Other: " + doc.inquiry_other(0) + Chr(10) + Chr(10) + "Issue: " + issue(0)
msg4 = msg2 + Chr(10) + Chr(10) + msg2a + Chr(10) + Chr(10) + msg3 + Chr(10) + Chr(10) + "http://dsks89.itg.ti.com/rfid/pic.nsf/DocID/" + docid(0) + "?OpenDocument"
Call MailSend(db,current_user(0), assigned_to_email(0), "", "", "Request No " & doc.RequestNo_1(0) & " has been assigned to you", msg4, "H") '//This is for debug purposes. Redirect the Notify Email to anyone.
Call doc.Save(True,False)
End Sub
The questions are,
1. is there anyway to run this during the import just after the save?
2. Or what is the best way to alter the script to accept the number generation after the document has been created. Because I have a view the looks at the documents after the import and If just need to alter the script to accept the number generation if the document is not new.
Any help would be great

