2012-01-23 2 views
0

내 저장 기능이 양식의 필드를 저장하지 않는 이유에 대해 분명한 이유를 알아낼 수 있습니까? 문서를 저장하지만 필드를 열면 필드가 비어 있습니다. 다음 코드는 내가 사용하고있는 코드입니다 :LotusScript 함수가 양식 필드를 저장하지 않습니다.

Public Sub co_loopNamesAndSaveDocs() 

'Dim variables 
Dim s As New NotesSession 
Dim thisDatabase As NotesDatabase 
Set thisDatabase = s.CurrentDatabase 
Dim ws As New NotesUIWorkspace 
Dim uidoc As NotesUIDocument 
Set uidoc = ws.CurrentDocument 
Dim currentDoc As NotesDocument 
Set currentDoc = uidoc.Document 
Dim newDoc As NotesDocument 
Dim PersonNameField As NotesItem 
Set PersonNameField = currentDoc.GetFirstItem("PersonName") 

'Loop through values in PersonNameField and create a new document for each value found 

Forall pName In PersonNameField.Values 

Set newDoc = New NotesDocument (thisDatabase) 
newDoc.Form="newLocationForm" 
newDoc.StartDate = currentDoc.StartDate(0) 
newDoc.EndDate = currentDoc.EndDate(0) 
newDoc.Duration = currentDoc.Duration(0) 
newDoc.StartTime = currentDoc.StartTime(0) 
newDoc.EndTime = currentDoc.EndTime(0) 
newDoc.Comments = currentDoc.Comments(0) 
newDoc.Status = currentDoc.Status(0) 
newDoc.LocationCode = currentDoc.LocationCode(0) 
newDoc.PersonName = pName 
Call newDoc.Save (True, False, False) 

End Forall 

End Sub 

미리 감사드립니다.

답변

4

코딩에서 명백한 오류가 보이지 않기 때문에 currentDoc의 필드가 비어 있기 때문에 newDoc의 필드가 비어 있다고 말할 수 있습니다. currentDoc이 uidoc.Document로 설정되었으므로 프론트 엔드 문서와 백엔드 문서간에 동기화 문제가 있음을 의미합니다. 즉, 값은 uidoc에 있지만이 코드를 호출하기 전에 백 엔드에 저장되지 않았습니다. 맞다면 currentDoc을 지정하기 전에 uidoc.save()를 호출 해보십시오. 백엔드에 저장하지 않으려면 데이터 소스로 백엔드를 사용하는 대신 uidoc.fieldGetText ("PersonName")을 사용하고 값을 파싱해야합니다.

+0

당신이 옳았다 고 생각합니다. 고마워요. – Thomas

관련 문제