This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 26, 2012, 3:28 PM
12 Posts

DbLookup special characters (e.g. '@' in emails)

  • Category: Other
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: DbLookup,unicode,email
  • Replies: 2
 Hello all,
 
I'm having some trouble with the DbLookup function in Xpages when the key I'm looking up contains special characters.  When I try to lookup a key that contains a special character (in my case '@' in an email), I get no results.  If I leave all the code identical but lookup a key (in the same Database/view/column) that has no special characters, the DbLookup works.  I was hoping someone could help me with this as I'm trying to lookup emails from a view.  Below is my code I'm using the XPage to call DbLookup in case someone spots some changes I need to make (e.g. enable Unicode somehow for instance):-
 
var userDB = new Array("WebServer", "Directory.nsf"); 
var emailAddr = getComponent("profile_Email").getSubmittedValue();           //This is the field on the XPage that is being read in
var emailList = @DbLookup(userDB, "EmailView",emailAddr, 3);
sessionScope.DEBUG_output = emailList;
 
In the above example "EmailView" has the emails in the 3rd column which is sorted alphabetically and the component "profile_Email" is the ID of the field where the user types in an email address to lookup.  As mentioned, this code doesn't return any results if I have an '@' symbol present, but will return results if I don;t include any special characters.
 
As always, thanks in advance, any input on this would be greatly appreciated. 
Thanks! 
Mar 27, 2012, 8:05 AM
17 Posts
Re: DbLookup special characters (e.g. '@' in emails)
Hi Neemesh,
 
there are no issues using @DbLookup with e-mail addresses.
 
Just some hints:
Have you inspected the submitted value - for example by printing it or displaying in a field?
Is the e-mail address column the first sorted column in the view?
Mar 27, 2012, 9:34 AM
12 Posts
Re: DbLookup special characters (e.g. '@' in emails)
Hi Rick,
 
Thanks for replying.  I think I may have made a rookie mistake here and your reply has cleared things up.  The email column wasn't the first sorted column in the view, it was the second.  I've now made a second view with the email being the first sorted column and pointed the DbLookup at that view instead.  Now it looks up the email correctly :)
 
At the risk of sounding even more like a rookie, I take it there's no way to have a view with 3 sorted columns and then DbLookup information from this view where sometimes the key is from column 1, 2 or 3?  Would the only way to achieve this be having 3 separate views where each view has a different column being set as the first sorted column?
 
I'm trying to keep the number of views for lookups down so if there's a way to do this without having multiple views that would be great (I could use FTSearch I suppose, but that relies on the index always being up to date and there may be windows of time where that's not the case).
 
Thanks

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal