Solved

LotusScript code needed...Please help !!!

Posted on 2002-03-25
11
478 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 200 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Lotus notes email code 13 94
Lotus notes view not working using Trim 14 209
sending email via lotus notes 8.5 using vba in access 5 526
Lotus Domino Server 9 4 87
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

808 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