使用类更改值字段

时间:2016-12-21 15:54:05

标签: lotus-notes lotusscript lotus

我正在学习lotusscript中的课程,我发现这个问题我不知道如何解决。

我有一个类,它读取一个字段,并且根据该字段的值,该类的方法必须更改为其他方法。方法是Status

代码类

%REM
    Library c_LlamadaCandente
    Created 28-nov-2016 by David Bernabe Palanco/ES/HPH
    Description: Comments for Library
%END REM
Option Public
Option Declare


%REM
    Class c_LlamadaCandente
    Description: Comments for Class
%END REM
Class LlamadaCandente

    ' Declare the parameters
    Private m_datStart As Variant
    Private m_datFinal As Variant
    Private m_strClaim As String
    Private m_strGroupClaim As String
    Private m_strStatus As String

    ' Constructor
    Public Sub New (dateStart, group, status)
        me.m_datStart = dateStart
        me.m_strGroupClaim = group
        me.m_strStatus = status
    End Sub

    ' Calculate the person who has to answer the form
    Public Function Responsable As String
        Dim group As String

        group = me.m_strGroupClaim

        Select Case group
        Case "Autos 1"
            Responsable = "user 1"
        Case "Autos 2"
            Responsable = "user 2"
        Case "Particulares 1"
            Responsable = "user 3"
        Case "Particulares 2"
            Responsable = "user 4"
        Case "Empresas 1"
            Responsable = "user 5"
        Case "Empresas 2"
            Responsable = "user 6"
        Case "Personales"
            Responsable = "user 7"
        Case "Lesiones"
            Responsable = "user 8"
        Case Else
            Responsable = "user 9"
        End Select
    End Function

    ' Change the status field
    Public Function Status As String        

        Select Case me.m_strStatus
        Case "Borrador"
            Status = "Pendiente"
        Case "Pendiente"
            Status = "Finalizado"
        Case Else
            Status = "Sin estado"
        End Select

    End Function

End Class

表格

在表单中,我有一个名为Estado的字段,其初始值为“Borrador”,以及带有此代码的buttom

Buttom Code

Sub Click(Source As Button)

    ' We create new object from Llamadas Candentes and then we instanciate it with the parametres
    Dim llamada As New LlamadaCandente(doc.FechaSolicitud(0), doc.LlcGrupo(0), doc.Estado(0))

    llamada.Status

    Call uidoc.Save
    Call uidoc.Close

End Sub

问题

当我致电llamada.Status时,我真的希望更改doc.Estado,但它不起作用。因此,当我完成对按钮的点击时,该字段的新值将具有“Pendiente”,但是当它关​​闭时的形式具有值“Borrador”作为开头。

有什么建议吗?

1 个答案:

答案 0 :(得分:3)

NotesDocument对象具有更改其值的方法。您正在更改LlamadaCandente对象上的属性,但是您想要更改文档对象上的值。

一个简单的解决方案是在点击处理程序中添加它:

doc.ReplaceItemValue("Status", llamada.Status)

uidoc.FieldSetText("Status", llamada.Status)