Hi,
I’m uploading data from a txt file and creating a new doc. There are computed fields that pull data from another view (@DbLookup(“Notes”:“NoCache”;“”:“”;“view”;field;2)).
When I see the document into to view, I am not able to see the data into the computed field, but when I open the document, the data is there. So I have to open it, save it, and only after these actions I am able to see the value from computed fields. Is there any way that I can do in LS to consider all data into the document?
Computed field uses the value from field codMaterial. DBLookup is working well…
Agent is:
Sub Initialize
Dim session As New notessession
Dim db As notesdatabase
Set db = session.currentdatabase
Dim view As notesview
Dim doc As New notesdocument(db)
Dim doc1 As New notesdocument(db)
Dim valorview As Variant
Dim item As Integer
Dim fileNum As Integer
Dim registro As String
Dim fileName As String
Dim index As Integer
Dim memo As NotesDocument
Set memo = db.CreateDocument
fileNum = Freefile()
On Error Goto trataErro
fileName = session.GetEnvironmentString( "Local" )
Open fileName For Input As fileNum
Line Input #fileNum, registro
var = Split(registro$, ";")
Set doc1 = New notesdocument(db)
doc1.form="formPai"
doc1.cotacao = var(0)
doc1.refConsulta = var(1)
doc1.Cliente = var(2)
doc1.ValProp = var(3)
doc1.Solicitante = Evaluate("@Name([Abbreviate];@UserName)",doc1)
doc1.DtHrSol= Cstr(Now())
doc1.VencColeta = var(6)
Call doc1.Save (True, True)
Do While Not Eof(filenum)
Line Input #fileNum, registro
var = Split(registro$, ";")
Set doc = New notesdocument(db)
doc.form="formFilho"
doc.cotacao = doc1.cotacao
doc.codMaterial = var(0)
doc.Desc = var(1)
doc.Qtde = var(2)
Call doc.MakeResponse(doc1)
Call doc.Save (True, True)
Call view.Refresh
Print "A importação está sendo processada. Por favor, aguarde!!!!!"
Loop
Close fileNum
trataerro:
Select Case Err
Case 0
Msgbox "Lote gerado com sucesso!", , "Lote OK!"
Case 9
Resume Next
Case 101
Msgbox "Documento não foi gerado! Favor verificar a existência do arquivo no diretório C:", , "Documento não gerado!"
Close FileNum
Exit Sub
Case Else
Msgbox "Documento não foi gerado! Favor verificar a existência do arquivo no diretório C:", , "Documento não gerado!"
End Select
End Sub
Thanks!
Márcia