使用 类 更改值字段
Change value field using Classes
我正在学习 lotusscript 中的 classes,我发现这个问题我不知道如何解决。
我有一个 class,它读取一个字段,根据该字段的值,class 的方法必须更改为其他方法。方法是Status
代码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
表格
在表单中,我有一个名为 Estado
的字段,其初始值 "Borrador",以及一个带有此代码的按钮
按键代码
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",作为开始。
有什么建议吗?
NotesDocument 对象具有更改其值的方法。您正在更改 LlamadaCandente 对象的属性,但您想更改文档对象的值。
一个简单的解决方案是将其添加到您的点击处理程序中:
doc.ReplaceItemValue("Status", llamada.Status)
或
uidoc.FieldSetText("Status", llamada.Status)
我正在学习 lotusscript 中的 classes,我发现这个问题我不知道如何解决。
我有一个 class,它读取一个字段,根据该字段的值,class 的方法必须更改为其他方法。方法是Status
代码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
表格
在表单中,我有一个名为 Estado
的字段,其初始值 "Borrador",以及一个带有此代码的按钮
按键代码
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",作为开始。
有什么建议吗?
NotesDocument 对象具有更改其值的方法。您正在更改 LlamadaCandente 对象的属性,但您想更改文档对象的值。
一个简单的解决方案是将其添加到您的点击处理程序中:
doc.ReplaceItemValue("Status", llamada.Status)
或
uidoc.FieldSetText("Status", llamada.Status)