Solved

LotusScript equivalent: @Unique(@DbColumn

Posted on 2002-03-28
8
2,202 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 100 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 10

Assisted Solution

by:zvonko
zvonko earned 25 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 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

20 Experts available now in Live!

Get 1:1 Help Now