Z_Beeblebrox
asked on
@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.
Hope my question makes sense,
Zaphod.
ASKER
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.
Zaphod.
Could you post the exact formula you're using? And if possible the name of the view you are trying to reference?
....Pentapod
....Pentapod
ASKER
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.ns f" ; "User Name" ; FullName ; "ID" ));
@Command( [OpenDocument] ; "";@Text(@DbLookup( "" ; "GSTHOLN1" : "Applications\\goAssets.ns f" ; "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.
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.ns
@Command( [OpenDocument] ; "";@Text(@DbLookup( "" ; "GSTHOLN1" : "Applications\\goAssets.ns
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.
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
....Pentapod
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([ToolsRefreshAllD ocs])
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([ToolsRefreshAllD
ASKER
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.
Zaphod.
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.
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.
ASKER
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.FieldGetT ext("FullN ame"))
Messagebox(doc.GetItemValu e("FullNam e"))
' The error occurs here
While Not(uidoc.FieldGetText("Fu llName") = doc.FullName)
Set doc = view.GetNextDocument(doc)
Messagebox("Looping")
Wend
Messagebox("Done looping")
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.FieldGetT
Messagebox(doc.GetItemValu
' The error occurs here
While Not(uidoc.FieldGetText("Fu
Set doc = view.GetNextDocument(doc)
Messagebox("Looping")
Wend
Messagebox("Done looping")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Jeez, talk about taking the long route, all that for this nice simple solution which works great!
Thanks a lot.
Zaphod.
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("";"";"(CompanyL
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