1
LotusScript에서 연관 배열을 구현하는 방법이 있습니까?
예인 경우 작은 데모 코드를 게시하십시오.
많은 감사!LotusScript의 연관 배열
LotusScript에서 연관 배열을 구현하는 방법이 있습니까?
예인 경우 작은 데모 코드를 게시하십시오.
많은 감사!LotusScript의 연관 배열
연관 배열을 LotusScript의 목록이라고합니다. Here's LotusScript의 목록에있는 IBM 페이지 해당 페이지에서
샘플 : 많은, 작동
' Declare a list to hold employee IDs.
' The list tags will be the names of the employees.
Dim empList List As Double
' Make absolutely sure empList is Double.
If TypeName(empList) <> "DOUBLE LIST" Then
Print "Warning: empList is " & TypeName(empList)
End If
If DataType(empList) <> 2053 Then
Print "Warning: empList is " & CStr(DataType(empList))
' We expected 2053 (that is, 2048 + 5).
End If
' Declare a String variable for user name.
Dim ans As String
' Declare a Double variable for user ID.
Dim yourID As Double
' Declare an Integer variable to serve as a flag.
Dim found As Boolean
' Create some list elements and assign them values.
empList("Maria Jones") = 12345
empList("Roman Minsky") = 23456
empList("Joe Smith") = 34567
empList("Sal Piccio") = 91234
' Ask the user to enter the name to be removed from the
' list of employees who have been assigned parking spaces.
ans$ = InputBox$("Which employee no longer needs a space?")
' Check to see if the employee's name appears as a list tag
' in the list. If not, display a message and stop. Otherwise,
' validate the employee's ID. If everything checks out,
' remove the employee item from the parking list.
If IsElement(empList(ans$)) = True then
Print ans$ & " is a valid employee name."
yourID# = CDbl(InputBox$("What's " & ans$ & "'s ID?"))
' The following ForAll block does two things:
' it checks to see if yourID# is a valid ID and,
' if so, if it matches the ID for the employee
' whose name is ans$. If so, that element is removed
' (erased) from the list. The found flag is initially
' FALSE (0). If yourID# is a valid ID, found is set to
' TRUE (-1). The variable empID is the reference variable
' in the ForAll loop.
found = FALSE
ForAll empID In empList
If empID = yourID# then
found = TRUE
If ListTag(empID) = ans$ then
Erase empList(ans$)
' Verify the removal of the list element.
If IsElement(empList(ans$)) = FALSE then
Print ans$ & " is no longer on the list."
End If
Else
Print "Valid ID but wrong employee."
End If
' No need to look further for yourID#,
' so get out of the ForAll loop.
Exit ForAll
End If
End ForAll
If found = False then
Print "No such employee ID."
End If
Else
Print "No such employee."
End if
감사합니다! 여기 –
는 목록에 대한 블로그 항목 내가 다시 잠시 썼습니다 : http://blog.texasswede.com/sntt-lists-the-forgotten-gem-in-lotusscript/ 그리고 여기 당신이 개선 할 수있는 방법의 예입니다 목록을 사용하여 성능을 크게 향상시킬 수 있습니다. http://blog.texasswede.com/using-lotusscript-lists-to-increase-performance/ –