@DBLookup problems

When I try to DBLookup, I get an entry not found in index error. Where is this index? And it is not the full text index since I have another database that can be accessed with DBLookup even though it is not indexed, but I have to copy an existing database that already had some special setting on it that allowed for lookups against it. Where is this setting?

Hope my question makes sense,

Zaphod.
LVL 7
Z_BeeblebroxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pentapodCommented:
In your @DbLookup formula, you give the name of a database and/or view to look up a value in.  This location is probably wrong, that will give you this "index" error.

The value that you are looking up should be in the first SORTED column of the view.  You also have to give the entire cascading path of the view if you are not referring to it by alias.

Here's an example, from the Field properties of a field in another form.  The field is a keyword field and looks up the keyword values you can choose from a hidden view:

@DbLookup("";"";"(CompanyLookup)";"Company profiles";2)

The name of the view is (CompanyLookup) and the first column is sorted categorically.  The @DBlookup is looking for everything under the view category "Company profiles", and will then give a list of everything in the second column of the view.

So the view looks something like this:

> Company profiles
        Coca Cola
        Sony
        Disney
        Microsoft
> CEO profiles
        Bill Gates
        Ito-san
        Michael Eisner

The keywords that would be displayed as choices for the field using the @DBlookup would be "Coca Cola, Sony, Disney, Microsoft"

Does this help?

Note - if you're referring to a view within the same database, @DBcolumn might be easier to use.  And remember if your view is cascaded that you need to use \\ in the name.  (For example  "Main\\By Company" not "Main\By Company")

....Pentapod
0
Z_BeeblebroxAuthor Commented:
I am trying to access one database from another, in particular, I am trying to get the contents of a field in a specific document. I had this problem before, where I was able to do this fine with one database that someone else made, but when I made my own this error always occured. I was able to get around the problem by making a copy of the other person's database, and then changing everything to make it mine: all the forms, views, database name, etc. As a result, I suspect there is some setting that I am missing that is preventing this from working. Since I am able to get it to work for this other database, and not the one I made from scratch, I am pretty sure that I am using the command correctly.

Zaphod.
0
pentapodCommented:
Could you post the exact formula you're using?  And if possible the name of the view you are trying to reference?

....Pentapod
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Z_BeeblebroxAuthor Commented:
OK, I think I'm a little out of it today. I can now do a database lookup (it was a silly mistake). I am still stuck with my overall goal though, could you help?

What I want to do is have a button on this form that, when the user clicks on it, will open a document in another database. Right now I am having two problems. What I have so far is a field in the document to be opened called ID which has a computed value of the unique ID of the document. Then, in the other database, I have a button which does a lookup in the other database to grab the ID then tries to do a document open on it. I am having two problems with this. One: for some reason I cannot make the database lookup work if the field that I am looking up is computed. This is a problem since I want to add this feature to a database that is already in use, so I can't use a default value to fill in the ID field. I could write a script to fill it in, so its not much of a problem, but nonetheless, that shouldn't be necessary. Two: I am getting the error message "Cannot execute the specified command". Here is my code:

@Prompt([OK];"kmed"; @DbLookup( "" ; "GSTHOLN1" : "Applications\\goAssets.nsf" ; "User Name" ; FullName ; "ID" ));
@Command( [OpenDocument] ; "";@Text(@DbLookup( "" ; "GSTHOLN1" : "Applications\\goAssets.nsf" ; "User Name" ; FullName ; "ID" ));"":"")

The prompt returns the ID so I know the dblookup is working.

Also, as a side note, do you know of an easy way to refresh all of the formulas in a database?

Thanks a lot,

Zaphod.
0
pentapodCommented:
Yikes... off-hand I have no answer, that may be a little beyond me.  I'll think about it but I've never tried anything like that.  Maybe one of the more expert experts?

....Pentapod
0
GunsenCommented:
1) If the ID ur looking up is a uniqueID try make it as text in the view column.  @Text(@DocumentUniqueID)

The computed field ur accessing, try displying it in a view column.
Then fetch the value using column number.

2) May be because 1) is failing.

x) To refresh the fields in all documents in a view og folder:
@Command([ToolsRefreshAllDocs])
0
Z_BeeblebroxAuthor Commented:
Ok, I see the problem now, you cannot use OpenDocument to open a document in another database... So, how can you open a document in another database? Any ideas?

Zaphod.
0
dalehendCommented:
I think you should bump the points up on this.
What ver. of Domino/Notes server are you running?
What ver. of Domino/Notes client are you running?

You can use LotusScript to grab the Document using NotesDatabase class
and then use NotesUIWorkspace class to change the UIDocument to the
background Document grabbed previously.

0
Z_BeeblebroxAuthor Commented:
I have another 125 points to waste, if someone gives an answer worth that. Thanks for the idea though, definately worth 50 points. Just one small problem, how do I access the contents of a NotesDocument so that I can compare it to the contents of a NotesUIDocument. Right now when I try to do doc.FullName where FullName is the name of a field, I get a type mismatch error. Maybe I haven't defined something correctly, so here is all of my code:

Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim db As New NotesDatabase( "GSTHOLN1", "Applications\\goAssets" )
Dim doc As NotesDocument
Messagebox("Opened database")
Set view = db.GetView("User Name")
Set doc = view.GetFirstDocument
Messagebox("Starting search")
Messagebox(uidoc.FieldGetText("FullName"))
Messagebox(doc.GetItemValue("FullName"))

' The error occurs here

While Not(uidoc.FieldGetText("FullName") =  doc.FullName)
    Set doc = view.GetNextDocument(doc)
    Messagebox("Looping")
Wend          
Messagebox("Done looping")
0
sk5tCommented:
First thing:  Unless you derive a great deal of personal satisfaction from it, or see this as a pathway to job security, I'd stop nesting functions so deep.  Use some temporary variables at *least* until the function works properly.  Besides, you're making the same database lookup twice and that's a performance hit.

----------
okTarget := @Text( @DbLookup( "" ; "GSTHOLN1" : "Applications\\goAssets.nsf" ; "User Name" ; FullName ; "ID" ) );

@Prompt([OK]; "kmed"; okTarget);

@Command([OpenDocument]; ""; okTarget; "");
----------

Now granted, that won't quite work due to the limits of the UNID.  But how about this?

key := FullName;

@Command([FileOpenDatabase]; "GSTHOLN1" : "Applications\\goAssets.nsf"; "User Name"; key; ""; "");

@Command([OpenDocument];"";"";"");

No @Dblookup necessary unless you need that [OK] prompt.  Lucky you, the target view is the same one you were using to fetch the UNID via some other key data.

LotusScript will also work--you can get a handle on the new document during the lookup--but is, I think, unnecessary here.  Better to use the formula language when possible.

Feel free to mail me at stv@ot.com if this isn't enough...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Z_BeeblebroxAuthor Commented:
OK, just name the number of points you want :)

Jeez, talk about taking the long route, all that for this nice simple solution which works great!

Thanks a lot.

Zaphod.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.