hcl-bot
November 16, 2007, 7:52am
1
In a profile document, I have a field (type:names) containing a role : [Admin]. This field might contains more than one role, but not for this example.
I have this basic script :
Dim ss As New NotesSession
Dim db As NotesDatabase
Set db = ss.CurrentDatabase
Dim pdoc As NotesDocument
Set pdoc = db.GetProfileDocument(“ProfilBase”)
Dim RolesCollection As Variant
RolesCollection = pdoc.GetItemValue(“prPermissionToDelete”)
Dim strPart1 As String, strPart2 As String, fullString As String
Forall R In RolesCollection
strPart1 = {@IsMember("}
strPart2 = {"; @UserRoles)}
fullString = strPart1 + R + strPart2
End Forall
Q: Can anyone tell me what ‘fullString’ will look like after the first pass of the Forall?
hcl-bot
November 16, 2007, 8:05am
2
Subject: LotusScript Trivia!
@IsMember (“[Admin]”; @UserRoles )
hcl-bot
November 16, 2007, 8:08am
3
Subject: RE: LotusScript Trivia!
I wish! That is exaclty what I try to get with that script… but it is not.
This script returns me :
@IsMember (“”[Admin]“”; @UserRoles )
(note the double quote)
hcl-bot
November 16, 2007, 8:14am
4
Subject: RE: LotusScript Trivia!
Then the quotes must be in R
hcl-bot
November 16, 2007, 8:19am
5
Subject: RE: LotusScript Trivia!
No. If I do a len(R), and R contains [Admin], it is returning 7. If the R were containing the quotes, I would have 9.
If I remove the quote from strPart1 and strPart2, like this:
strPart1 = {@IsMember (}
strPart2 = {; @UserRoles )}
fullString = strPart1 + R + strPart2
what I get?
@IsMember ([Admin];@UserRoles )
I cannot have a string with
@IsMember (“[Admin]”; @UserRoles )
hcl-bot
November 16, 2007, 8:45am
6
Subject: RE: LotusScript Trivia!
Strange. On the other hand, when I debug lotusscript code, I often see the double quotes. They don’t seem to matter.
hcl-bot
November 16, 2007, 8:50am
7
Subject: RE: LotusScript Trivia!
Sebastien,
The code works fine for me and returns
@IsMember (“[Admin]”;@UserRoles )
If you write R to a string variable before the message box and debug, what is the value
Mike
hcl-bot
November 16, 2007, 8:47am
8
Subject: LotusScript Trivia!
hcl-bot
November 16, 2007, 9:01am
9
Subject: RE: LotusScript Trivia!
I was doing a MsgBox rather than debugging and it worked fine for me based on the message I was seeing
Thanks for that info Willy. I learn something new everyday. Much appreciated
hcl-bot
November 16, 2007, 9:33am
10
Subject: LotusScript Trivia!
You guys are totally right!.I learn new stuff everyday!
Many thanks.
hcl-bot
November 16, 2007, 11:54am
11
Subject: LotusScript Trivia!
And by the way: What are your further plans with this string, once you have build it?
I’ve got a vague idea, but would like to remind you of
roles = notesDatabase.QueryAccessRoles(name$)
number = ArrayGetIndex(roles, “[Admin]”)
just in case. Formula execution using Evaluate is just as fast as everywhere else, but switching between engines imposes some delay.