?
Solved

I need Visual Basic code to scroll to a document in notes.

Posted on 1999-07-01
11
Medium Priority
?
286 Views
Last Modified: 2013-12-18
Hi,
I need VB code (if possible, if not, then I'll try and decypher notes script) to navigate within notes and select a certain document within a CATEGORIZED view.

If I use:
objNotesws.OpenDatabase "server", "database", "view", "document"
then it takes me to the title of that document.  I need to drill down and actually select the relevant document, so that the user can then open the document within notes.
Ie:
I need:
>Title1
   >Title2
      >Title 3.
But I get:
>Title1
I hope this makes sense.
0
Comment
Question by:deljones
[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
  • 2
  • +1
11 Comments
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119681
u want a categorized view to appear in a VB prog and the user to be able to choose any document and get it displayed in notes? is that it?
0
 

Author Comment

by:deljones
ID: 1119682
Not quite.  I've got some Oracle tables from which I get some information that is also stored on a notes database.  Then in my vb prog, the user selects a record, then I want to switch to notes, to the relevant document in the notes view.  Then they can do what they want with this docuement in notes.  The problem is, that because the view in notes is categorised, the record selected when I open the view (with OpenDatabase) is the very high level 'title' rather than the actual document I want.

Phew...
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119683
ok u mean the parent document is the one that is getting selected, and u want the VB prog to open the view in notes with the right child document selected.  I will see about that.
0
Technology Partners: 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 6

Expert Comment

by:ghassan99
ID: 1119684
Notes will always locate documents based on the first sorted column in a view.  Since the first one is the categorized view, Notes will stop there in the first category that contains the document even within nested categories. I suggest the following work around.  Instead of Notes drilling down to the document, open the document for the users. Check this snippet of code:

Public session As NOTESSESSION
Public db As NOTESDATABASE
Public view As NOTESVIEW
Public doc As NOTESDOCUMENT
Public ws As NOTESUIWORKSPACE
Public testvar As Variant

Private Sub Command1_Click()
   Set session = CreateObject("Notes.NotesSession")
   Set db = session.GETDATABASE("", "test.nsf")
   Set ws = CreateObject("Notes.NOTESUIWORKSPACE")
   Call ws.OPENDATABASE("", "test.nsf", "test", "Kenan")
   Set view = db.GETVIEW("test")
   Set doc = view.GETFIRSTDOCUMENT
   
   Do While Not (doc Is Nothing)
      testvar = doc.GETITEMVALUE("name")
      If testvar(0) = "Kenan" Then Exit Do
      Set doc = view.GETNEXTDOCUMENT(doc)
   Wend

   Call ws.EDITDOCUMENT(False, doc)
   Set doc = Nothing
   Set view = Nothing
   Set db = Nothing
   Set session = Nothing
End Sub

Modify this to ur own needs. u have to put a field as a serach criteria to look for a specific doc.
0
 

Author Comment

by:deljones
ID: 1119685
Thanks for your answer ghassan99,
I already have code to do this via an uncategorised view:

Set sess = CreateObject("notes.notessession")
Set db = sess.getdatabase("server", "database")
Set view = db.getView("UncategorisedView")
set doc = view.getdocumentbykey
ws.editdocument false, doc

But I really need to navigate to the document in a categorised view.

Is there a way of executing lotus @commands in visual basic?


0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119686
I truly believe its not possible, I tried creating a hidden view, but it will affect the categorization.  Notes will just encounter the categories first since they are the first sorted column.  
0
 
LVL 3

Expert Comment

by:Gunsen
ID: 1119687
A lookup in a categorized view - should be the same as an uncategorized.
If you use a key like "Title1\Title2\Title3" you should try replacing code with this:

Dim key(1 To 3) As String
key(1)="Title1"
key(2)="Title2"
key(3)="Title3"
...
Set doc = view.GetDocumentByKey( key )
...
Regards
Gunsen
0
 

Author Comment

by:deljones
ID: 1119688
This code will only work with the back-end navigation.  I can find the document I want via an uncategorised view, but I can't navigate to it and highlight it with this categorised view on the UI.  I think the only way you can actually highlight a document in a view is with the

OpenDatabase server, database, view, key

command, but as I say, this only takes me to the category, rather than the actual document.  I tried putting an array on the key bit of the command, but that didn't work either.
0
 
LVL 6

Expert Comment

by:ghassan99
ID: 1119689
yes, the opendatabase method is the only way available, coz looking up keys is based on a sorted column.  Gunsen's proposal will just move u closer to the category.  No solution for this:)
0
 
LVL 2

Expert Comment

by:mchampou
ID: 1119690
Sorry I didn't read through all the previous post, perhaps someone already went this way ...

After having found the document, you could put the DocUniqueID of the document in a profile document within the database of in an environment variable and then call an agent that will select the document.

The agent will fetch the DocumentUniqueID and then perform a SELECT on the UNIQUEID

ex:

UNID := @Environment("$TheDocIwantSelected")
SELECT @IsMember(UNID;@DocumentUniqueID)

...

anyway, I suspect to have an error in my code up there (wich parameter the @IsMember uses) and I don't know if the category will be open ...

At worse, and once the document is selected, you can alway call @Command([ViewShowOnlySelected]) followed by a @Command([ViewExpandAll]) or something like that ... that will make only the selected document appear ...

If it solves your problem, I'll post this as an answer.

mchampou
0
 
LVL 3

Accepted Solution

by:
Gunsen earned 600 total points
ID: 1119691
For a NotesR4.6 client You could use the NotesUIView class - SelectDocument method.
Trigged by QueryOpen-event you could use following code:

Sub Queryopen(Source As Notesuiview, Continue As Variant)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
     
Dim key(1 To 3) As String
key(1)=session.GetEnvironmentString( "MyTitle1" )
key(2)=session.GetEnvironmentString( "MyTitle2" )
key(3)=session.GetEnvironmentString( "MyTitle3" )

If key(1)<>"" Then
  Set db = session.CurrentDatabase
  Set view = db.GetView("View")
  Set doc = view.GetDocumentbykey(key)
  Call Source.SelectDocument(doc)
  Call session.SetEnvironmentVar( "MyTitle1", "" )
End If
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

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…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

718 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