[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

LotusScript code needed...Please help !!!

Posted on 2002-03-25
11
Medium Priority
?
484 Views
Last Modified: 2013-12-18
Hi Experts,

I'm looking for a piece of code to implement in a application. I can't write LotusSrcript (yet) and I think in this case I need to do this function using LotusSript...

When I want to assign values whitin Readers or Author fields, I can assign these addresses using the Address dialog from the names.nsf on the server.
I want that the user is able to assign a group of user from their personall addressbook.

Can anybody create such code for me ?

Greetings,

Bob
0
Comment
Question by:oosterbaan
  • 5
  • 3
  • 3
11 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6894062
Use this in a button to select readers/Authors and set it to field accordingly,

NotesID := @PickList( [Custom]  ; "" : "names.nsf" ; "($VIMPeopleByLastName)" ; "Title" ; "Please select the notes id's " ;5);

@prompt([ok]; ""; NotesID);

FIELD Readers := Readers : NotesID;
FIELD Authors := Authors : NtoesID;
@True

~Hemanth
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6895080
Thanks Hemanth,

You"re getting close, but this is not exactly what I was "trying" to ask (-:

I must be more clearly... (I Think). Users has created their own groups in their PAB. I want that people are able to select those groups. I think that after selecting a groupname, such a groupname must be divided into the residing IDs

Greetings,

Bob
0
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 800 total points
ID: 6895249
Here is the script, which goes in a button

Sub Click(Source As Button)
     Dim session As New NotesSession
     Dim workspace As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Dim doc As NotesDocument
     Dim item As NotesItem    
     Dim NamesDB As NotesDatabase
     Dim GroupDoc As NotesDocument
     Dim GroupView As NotesView
     
     server = ""
     dbpath = "names.nsf"    
     
     Set db = session.CurrentDatabase
     Set uidoc = workspace.CurrentDocument
     Set doc = uidoc.document
     groups = workspace.PickListStrings( PICKLIST_CUSTOM, True, server, dbpath, _
     "Groups", "Groups List", "Choose a group", 2 )
     
     Set NamesDB = New NotesDatabase(server,dbpath)
     Set GroupView = NamesDB.GetView("($PeopleGroupsFlat)")
     count = 0
     Forall groupName In groups
          Set GroupDoc = GroupView.GetDocumentByKey(groupName)
          Set item = GroupDoc.GetFirstItem("Members")
          Forall names In item.values
               Redim Preserve members(count) As String
               members(count) = names    
               count = count + 1
          End Forall
     End Forall
     ' Set the field to the members
     doc.Members = members
     
End Sub


PS: I ASSUMED THAT THERE IS A FIELD CALLED MEMBERS WHICH STORES THE RESULT
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 10

Expert Comment

by:zvonko
ID: 6895384
Hello Bob,

I assume you have an Authors field with the field name: GroupMembers
This field should be controled by the contenet of another field with the name: GroupName

The field GroupMembers is Computed and has this formula:
FIELD GroupName:=GroupName;
@If(GroupName="";@Return("");"");
tmpGroupMemebers:=@DbLookup("";"":"names.nsf";"Groups";GroupName;"Members");
@If(@IsError(tmpGroupMemebers);"";tmpGroupMemebers)

The effect is, when a valid GroupName is found in local names.nsf, then are its Member names placed into Author field named GroupMembers.

If you want to offer an input help for the GroupName field, then place this formula into InputTranslation of GroupName field:
@If(GroupName="";@PickList([Name]);@Trim(GroupName))

Is this something for you?


0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6897459
Thanks...really great script and works fine...

Also thx to you Zvonko for your suggestion !!!

Greetings,

Bob

P.S. Is it also possible to concatenate the result of this script to the field members (so if there is already a value in it, it will be appended ?)
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6897501
Then use appendtotextlist method

last line, doc.Members = members will transform as

dim memItem as NotesItem
set memItem = doc.GetFirstItem( "Members" )
Call memItem.AppendToTextList( members )
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6897516
Thx HemanthaKumar.....
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6897551
Bob, it is always good to have working LotusScript code,
but it is even better to have short handy @Formulas...

So I hope next time :-)

So long,
zvonko
 
0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6897768
No Zvonko.....You're wright. I'll try your option also (tomorrow) and get back to you later....
0
 
LVL 10

Expert Comment

by:zvonko
ID: 6903578
No need for this Bob. I am on vacation for a while and Heman is really a great help in any situation (when does this man sleep :-)
It is only fair that he gets the points :-)

Cheers,
zvonko

0
 
LVL 1

Author Comment

by:oosterbaan
ID: 6903681
Thx Zvonko, but I'm really interested in your solution also... You are both point junkies (-: So you will get you're share !!

Happy hollydays....

Bob
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month20 days, 14 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question