Change value field using Classes

144 views Asked by At

I am learning the classes in lotusscript and I have found this issue that I don't know how to solve.

I have a class where it read a field, and depending of the value of this field the method of the class have to change to other. The method is Status

Code Class

%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

Form

Into the form I have a field called Estado with the initial value "Borrador", and a buttom with this code

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

The issue

When I call llamada.Status I really hope to change the doc.Estado, but it doesn't work. So when i have done click into the buttom the new value of the field will have "Pendiente", but the form when it is closed has the value "Borrador", as the beginning.

Any suggest?

1

There are 1 answers

4
Ken Pespisa On BEST ANSWER

The NotesDocument object has methods for changing its values. You are changing the properties on the LlamadaCandente object but you want to change the values on the document object.

One simple solution is to add this in your click handler:

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

or

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