?
Solved

LotusScript code needed...Please help !!!

Posted on 2002-03-25
11
Medium Priority
?
483 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

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.

Question has a verified solution.

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

Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 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