Improve company productivity with a Business Account.Sign Up

x
?
Solved

LotusScript equivalent: @Unique(@DbColumn

Posted on 2002-03-28
8
Medium Priority
?
2,438 Views
Last Modified: 2013-12-18
I have a pair of agents now that I use to update one field in a collection of selected documents from a view. Both are done in @Formulae.

The first agent is set as Run Once. It prompts the user for the new value for the field. It writes the value to an environment variable, and then calls the other agent.

The second agent runs on all selected records. It reads the environment variable, makes some comparisons with existing data in each record, and updates (or not) accordingly. Under some circumstances it also sends a mail notification to a list of people that it derives from an @DBColumn.

All this works well, but now I need to add something else. I need it to (under some circumstances) open a new record in a different database for the user to complete. If there are five documents selected in the view and three of these documents match the circumstances, I need for it to create three new records in the other database for the user to fill in the blanks (with some information inheriting over from the source document).

The trouble is that requires an @Command, and you can't use those in an agent that runs on selected documents.

So I need to convert the second agent to LotusScript, I presume. The trouble is, while I do fine at reading LotusScript, I don't know the classes well enough to be quick with coding it.

I've got the script working on the selected documents and performing all the necessary updates without any problem. But I can't figure out how to extract the mailing list.

The current mailing list comes from
   @Unique(@DbColumn("Notes": ""; ""; "(GUIStaff)"; 1))

How do I get this in LotusScript?

After I get the list, I think I've figured out doc.Send() well enough to handle the mailing.

But then I still have the challenge of opening new records in the other database. This needs to open a new record for each document that matches the right conditions and leave it open for the user to complete. Optimally, it would be something like this:

If rightConditions = 1 Then
    Evaluate("@Command([Compose]; @Subset(@DbName; 1): "OtherDB.NSF"; "FormName")")
End If

But you can't evaluate @Commands. So how can I do these things?

Thanks for any help -- b.r.t.

p.s. zvonko -- If this question looks familiar, it's because I had a similar one the other day. But I figured out how to do parts of it, so I deleted the question, which still showed no answers. Later I got a notification that you had responded to the first post, apparently at the same time I deleted it. I've not been able to read your post on that question. Sorry!
0
Comment
Question by:BarryTice
  • 3
  • 3
  • 2
8 Comments
 
LVL 24

Accepted Solution

by:
HemanthaKumar earned 400 total points
ID: 6903717
For getting the column values, you have to loop through the documents in view like this, there is no equivalent method as dbcolumn, but this block is a variant to it.

'Set the value of db
Set view = db.GetView("(GUIStaff)")
set doc = view.GetFirstDocument
Count = 0
while not doc is nothing
Redim preserve strArr(count) as String
strArr(count) = doc.Sender(0) ' Value representing the I column in the view
set doc = view.GetNextDocument(doc)
count = count + 1
Wend
' strArr would store the values of sender

to Compose Document, there is an equivalent script method in notesuiworkspace

Syntax
=======================
ComposeDocument method  

Example
Using a database and form you specify, creates a new document and displays it on the workspace.
Defined in
NotesUIWorkspace
Syntax
Set notesUIDocument = notesUIWorkspace.ComposeDocument( [ server$ [, file$ [, form$ [, windowWidth# [, windowHeight#  ]]]]] )
Parameters
server$
String. Optional. The name of the server where the database resides. If this parameter is omitted or is an empty string (""), the database is opened on the local computer. If both server$ and file$ are omitted or empty strings, the current database is used.
file$
String. Optional. The file name of the database you want to compose a document in. If this parameter is omitted or is an empty string (""), a document is composed in the current database.
form$
String. Optional. The name of the form you want to use to compose the document. If this parameter is omitted or is an empty string (""), the Create Other dialog box is displayed and the user can select a form name.

windowWidth#
Double. Optional. The width in inches of the document window. If this parameter is omitted, the window is the width of the current window.
windowHeight#
Double. Optional. The height in inches of the document window. If this parameter is omitted, the window is the height of the current window.
Return value
notesUIDocument
The document that was just created and opened.
=======================

~Hemanth
0
 
LVL 7

Author Comment

by:BarryTice
ID: 6905011
HemanthaKumar --

Where you have:
    strArr(count) = doc.Sender(0) ' Value representing the I column in the view

If the field in the document allows multiple entries, would it be appropriate to use
    strArr(count) = doc.Sender
instead?

Thanks. --- b.r.t.
0
 
LVL 7

Author Comment

by:BarryTice
ID: 6905022
Also, if the field allows multiple entries and the view is set to show multiple values as separate entries, will the document be selected more than once as it steps through the view? And how do you handle the @Unique() part, short of sorting the resulting array and stepping through to eliminate the duplicates?

-- b.r.t.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 6905061
I have modified the script based on your comments, This would ensure uniqueness and multivalue in the field "Sender"

     'Set the value of db
     Set view = db.GetView("(GUIStaff)")
     Set doc = view.GetFirstDocument
     Count = 0
     While Not doc Is Nothing
          Forall vals In doc.Sender
               Redim Preserve strArr(count) As String
               IsInArray = Arraygetindex( strArr, vals, 5 )
               If IsInArray = Null Then
                    strArr(count) = vals
                    count = count + 1
               End If              
          End Forall          
          Set doc = view.GetNextDocument(doc)          
     Wend    
0
 
LVL 10

Assisted Solution

by:zvonko
zvonko earned 100 total points
ID: 6910920
Hello Barry,

it is important to know which Notes version this has to work.
If all users use R5, then you can use nice new R5 features for this unique request...

And for this deleted question; never mind: you got no code (I got no points :-)

<|;-)

0
 
LVL 10

Expert Comment

by:zvonko
ID: 6948814
Hello Barry,

do you have interest in this new R5 feature?

0
 
LVL 10

Expert Comment

by:zvonko
ID: 7116901
Hello Barry...
0
 
LVL 7

Author Comment

by:BarryTice
ID: 8849787
Sorry, guys. This seems to have fallen off my radar last year. Notes development is something I'm "allowed" to do in my spare time at work, but it's not part of my official job description. (Of course, they don't have any other Notes developers.) Anyway, It's not uncommon for me to start on a project and get pulled off to work on something else. That happened here.

Anyway, thanks for your help!

-- b.r.t.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
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…
When you have multiple client accounts to manage, it often feels like there aren’t enough hours in the day. With too many applications to juggle, you can’t focus on your clients, much less your growing to-do list. But that doesn’t have to be the cas…
Watch the video to know the simple way to remove or recover or reset lost or forgotten passwords of Outlook PST file. With Kernel Outlook Password Recovery tool such operation is very easy to perform. It is a freeware with limitation to use with 500…

608 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