Edit the current location only using lotusscript

Hi there, how do i set a statement that will be able to change some information on the current location only(lotusscript). I’m having problems with that matter, because the statements(script) i’ve been using,changes every location but the requirement should be that only the current location will be edited.is there any possible way?

would this statement be of help regarding my problem?

curloc=session.getenvironmentstring(“Location”, True)

thanks in advance…

Subject: Edit the current location only using lotusscript

Sure will – split() the value you get back on “,”, and the second value will be the NoteID of the document you want to modify.

Subject: RE: Edit the current location only using lotusscript

hi stan, well, i’m not that familiar with the statement split(), could you elaborate me more or discuss briefly some info about the statement, if you don’t mind?

well this is my current script, would you mind evaluate it? thanks…

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim session As New NotesSession

Dim db As New NotesDatabase(“”,“names.nsf”)

Dim view As notesview

Dim doc As NotesDocument

Dim a As Integer

Dim tmp As String

Dim curloc As String

Set uidoc = workspace.CurrentDocument

Set view = db.GetView(“Locations”)

curloc=session.getenvironmentstring(“Location”, True)

For a=1 To Len(curloc)

tmp=Left(curloc,a)

If Right(tmp,1)=“,” Then useloc=Left(curloc,a-1)

If Right(tmp,1)=“,” Then Goto Found

Found:

Set doc = view…GetFirstDocument

If curloc = doc.LocationName(0) Then

If doc.MailServer(0) <> “” Then

doc.sametimeserver = “Server2/GS3”

Call doc.Save(True,False)

End If

Set doc = view.GetNextDocument(doc)

End If

next

Subject: RE: Edit the current location only using lotusscript

Dim nsess As NotesSession

Dim strNoteID As String

Dim varTmp As Variant

Set nsess = New NotesSession

'// example using “split” function:

varTmp = Split(nsess.GetEnvironmentString(“Location”, True), “,”)

strNoteID$ = varTmp(1)

Msgbox "NoteID = " & strNoteID$, , “DEBUG . . .”

'// example using StrToken function

strNoteID$ = Strtoken(nsess.GetEnvironmentString(“Location”, True), “,”, 2)

Msgbox "NoteID = " & strNoteID$, , “DEBUG . . .”

’ Now you can get a handle to the document via the GetDocumentByID method of NotesDatabase class.

’ You don’t need to get a handle to the locations view.

hth,

dgg

Subject: RE: Edit the current location only using lotusscript

hey stan and dallas thanks for the information…i really appreciate it…hope i can be of help in your problems in the days to come…thanks again…good day…!

Subject: RE: Edit the current location only using lotusscript

It’s a good R5 piece, but Split is easier and faster (not that speed is a problem in something this small, but if you do it 10,000 times in an agent, it makes a difference). Split explodes a string into an array, so getting the NoteID is simply:

curloc = Split(session.getenvironmentstring(“Location”, True),“,”)

noteID = curloc(1)

You’d want to include a bound check – handling Error 9 is going to be more efficient than checking Ubound(curloc) in most situations I can think of. Again, that’s more of a concern when the code is running on a lot of long strings rather than one little guy.