Solved

LotusScript code needed...Please help !!!

Posted on 2002-03-25
11
475 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 10

Expert Comment

by:zvonko
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 24

Expert Comment

by:HemanthaKumar
Comment Utility
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
Comment Utility
Thx HemanthaKumar.....
0
 
LVL 10

Expert Comment

by:zvonko
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
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.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now