I have an XPage that is doing an @DbLookup with a user's input and trying to find that value in a view in a different database yet on the same server.
I have already verified that the view is in fact sorted by the first column and therefore @DbLookup friendly. The following code below appears in the server-side Javascript OnClick
event handler for a button on my XPage.
My problem is that the an error occurs when trying to assign the value of lRep to the 'firstNameLabel'. lRep is returning a null value from the dbLookup even though the a record under the 'FirstName' field exists with the key 'P301993'. This dbLookup should be finding a returning a single 'FirstName' result. However, it is not.
var resultLabel = getComponent("firstNameLabel");
var dbName = new Array(@DbName()[0],"UKCSandbox.nsf");
var lRep = @DbLookup(dbName,"customerLookup","P301993","FirstName");
resultLabel.setValue(lRep.toString());
lRep = (typeof lRep == "string") ? "No result" : lRep;
. Have you missed assigninglRep
value in actual code or the one reproduced here? – Naveen