Is it possible to allow users to view and retrieve data while working in a database from another database? If so, please provide an example or starting point.
Thanks,
Duane E Grayson
Is it possible to allow users to view and retrieve data while working in a database from another database? If so, please provide an example or starting point.
Thanks,
Duane E Grayson
Subject: Retrieving data from another database on the fly
Not knowning exactly what you are looking for, I would say that the easiest example would be a DocLink in a Rich text field; but if you are looking for programmatic control over the data take a look at the @DBColumn/@DBLookup functions.
@DbColumn( class : cache ; server : database ; view ; columnNumber )
@DbLookup( class : cache ; server : database ; view ; key ; fieldName ; keywords )
In practice the function language would look something like this (note the error checking):
tmp := @DBLookup(“”:“nocache”;“myserver”:“anotherdb.nsf”;“myview”;“mykey”;“fieldIamInterestedIn”);
@If(@IsError(tmp);“Error Message”;tmp)
This function snippet does the following:
goes and looks at the database “anotherdb.nsf” on the server “myserver” for a view titled “myview”. It searchs the first categorized column in the view for the value “mykey” and returns the value from the field “fieldIamInterestedIn” from all matching documents.
This is a handy way to lookup a list of values from another database and use it in your current document. If you know something about the particular document you need to get data from in the other database, you can use a couple of different identifiers to specify that particular document and retrieve the precise data you need.
Another method might be to use an single category embedded view from another database in your document if you need access to several identifiable documents from the other database.
Subject: RE: Retrieving data from another database on the fly
The user will need to retrieve multiple fields from the selected document. Will I be able to use this method to accomplish this result?
Thanks,
Duane E Grayson
Subject: RE: Retrieving data from another database on the fly
Yes you can, but there are couple of ways to do it.
If it is just a couple (maybe a max of 5) lookups that you need and the number of documents you are pulling from is small, then you can code each lookup individually, however there is a performance hit doing this.
Alternatively, if you need several data elements from the retrieved document you could create a view in the database that has your key in the first column, and then in the second column computes a seperated list of the data elements you need to retrieve.
for example, lets say we need to retrieve some contact info…
We could create a computed column like this…
fname + “·” + mInitial + “·” + lname + “·” +phone + “·” + address1 + “·” + address2 + “·” + city + “·” + state + “·” + zipcode
Then, I do the lookup from a hidden computed for display field, I get 9 data elements for the performance price of one lookup.
To populate the resultant fields, I can use the @Word function and identify the element by a positional reference ie in the ContactLName field I could have the computation of @Word(lookup;“·”;3)
But like I said, there are numerous ways to do the same thing. You can use LotusScript in an action button (Client, not web), LotusScript in a WebQueryOpen agent, etc etc etc