Hey people. I’m very new by using lotusscript. And I need a little help of you. Sorry for my poor english too.
I’m making an agent to calculate average from two fields dates on web. The agent run and show the alert but when it finished I got the error “Agent done”.
I’ve already signed the database. In the server console theres no errors too.
Could you help me to resolve this pluzze?
Thanks in advance.
Heres the code.
MsgBox “Entrou no agente!”
On Error GoTo TrataError
Dim ses As New NotesSession
Dim db As NotesDatabase
Dim vis As NotesView
Dim col As NotesDocumentCollection
Dim contotal As Integer
Dim numeracao As Double
Dim docMig As NotesDocument
Dim doc As NotesDocument
Dim autor As Variant
Dim data() As String
Dim contpont As Long
Dim data1 As Variant
Dim data2 As Variant
Dim criacao As Variant
Dim cria As Variant
Set Webdoc = ses.DocumentContext
Set db = ses.CurrentDatabase
Set vis = db.GetView(“Autores”)
Set docMig = vis.Getfirstdocument()
Set col = db.Alldocuments
Set doc = col.Getfirstdocument()
criacao = docMig.dat1
MsgBox criacao
QueryString = Webdoc.Query_String_Decoded(0)
data1 = RetornaCampo(UCase(QueryString),UCase(“rel_data1=”))
data2 = RetornaCampo(UCase(QueryString),UCase(“rel_data2=”))
'cria = retornacampo(UCase(querystring),UCase(“dat1=”))
contpont = col.Count
contpont = 0
'criacao = RetornaCampo(UCase(QueryString),UCase(“dat1”))
If doc Is Nothing Or (criacao > data2) And (criacao < data1) Then
MessageBox “Entrou na validação incorreta!”
Print “<script language=”“JavaScript”" type=““text/javascript””>"
Print |var path = window.location.pathname.substring (0, window.location.pathname.toLowerCase().indexOf(“.nsf”) + 4);|
Print “alert('Data Fora do período inserido para análise!” “.')”;
MessageBox “Data Fora do período inserido para análise!”
Print |var path = window.location.pathname.substring(0, window.location.pathname.toLowerCase().indexOf(“.nsf”) + 4);|
Print “”
Exit Sub
ElseIf criacao < data2 and criacao > data1 Then
MessageBox “entrou no if certo, pra a analise das medias”
Print “Verificando média…”
Set doc = col.Getnextdocument(doc)
contpont = contpont + 1
End If
MsgBox contpont
contotal = contpont
numeracao = CInt(contotal/5)
Print “<script language=”“JavaScript”" type=““text/javascript””>"
Print |var path = window.location.pathname.substring(0, window.location.pathname.toLowerCase().indexOf(“.nsf”) + 4);|
Print “alert('Média de Migrações realizada durante a semana:” + CStr(numeracao) + “.')”;
MessageBox “Média de Migrações realizada durante a semana:” & CStr(numeracao), 64, “Resultado”
Print |var path = window.location.pathname.substring(0, window.location.pathname.toLowerCase().indexOf(“.nsf”) + 4);|
Print “”
TrataError:
MessageBox “Data de criação:” & criacao & Chr(13) & "Primeira data inserida: " & data1 & Chr(13) & “Segunda data inserida:” & data2
MsgBox “Erro:” + Error + Chr(10)+ " na Linha" + CStr(Erl) + Chr(10)+ “numero” + CStr(Err)
Exit sub
End Sub