Xpages – (@DbLookup Help !)


i have been using this code to get information from names.nsf

T1:=@DbLookup(“”;”server”:”Names.NSF”;”People”; @Name([CN];Name);”Manager”);

@If(@IsError(t1);””;@Name([CN];T1);)

now using Xapges i converted this to this code

db = @Subset(@DbName(),1),”names.nsf”;
User = session.getCommonUserName();
server = session.getServerName();
result = @DbLookup(“”:””;server:db;”$VIMPeople”;User;”Department”;””);
return result

but am not getting anythink back , anyone see why ?

Advertisements

6 thoughts on “Xpages – (@DbLookup Help !)

  1. The syntax for the XPage version of @DBLookup is not the same as the regular @Functions. You need to use comma’s instead of semi-colons as delimiters plus the parameters are different.

    The options are
    @DbLookup(dbName, viewName, key, colNumber )
    @DbLookup(dbName, viewName, key, fieldName )
    @DbLookup(dbName, viewName, key, colNumber, keywords )
    @DbLookup(dbName, viewName, key, fieldName, keywords )

    But the dbName parameter needs to be an array or string list so use code like this
    var dbName = new Array(“”,”lookupdb.nsf”);
    var lRep = @DbLookup(dbName,”Viewname”,lookupvalue,2);

  2. And just to add to Paul’s comment, You’ll want to use the @DbName() to get the server, etc when performing the lookup, not just “” … using “” is ok for browser apps, but not necessarily ok for XPiNC

  3. Thanks guyes , you got me on the right track 🙂 – Am leaving for 4 weeks vacation after today so its great to finish this before. Have a great weekend

  4. Thanks Jeremy Hodge. I have been battling with something working in the browser using “” for the database parameter, but not working in XPiNC. Using @DBName() fixed this.

  5. Pingback: relevant keywords

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s