This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.



Mar 5, 2017, 10:38 PM
2 Posts
topic has been resolvedResolved

Xpages profile lookup

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: Xpages,IBM Notes,Javascript
  • Replies: 3

Hi, 

  I need help in setting data source in Xpages using lookup from profile document. 

  The profile document has server and dbpath in separate fields.

  As of now, i'm successful in getting them in individual fields and using 'session variable' from profile documents, If that helps

But need help in forming datasource to be used further in the database. 

Thanks  for all your assistance. 

 

Regards, 

Harris. 

 

 

Mar 6, 2017, 1:02 PM
589 Posts
hmm

I'm not sure I'm totally understanding the question.  First I would say that if possible avoid using profile documents in XPages.  Just use normal documents if that's on option.  Profile documents are cached by the server and I believe you'll have inconsistent requests in retrieving values after updates.

 

Not sure what you're looking for regards to DataSource.  For xpages you should read in the values you want from the doc and then put them into ApplicationScope.  You can't hold onto a NotesDocument itself in memory for long term.  And this presents the next problem with profile documents.  You're now caching them twice really.

If there's no need for a client app piece I suggest you switch to using a normal document.  Have an xpage to update the values.  On save you update application scope variables.  You would then need a small code block to simple load those values if they don't already exist on your web pages.  Probably not explained great but that I believe is the best practice here.

 

Good Luck

Dave

NotesIn9.com

Mar 6, 2017, 10:18 PM
2 Posts
Thanks Dave

Hi Dave,

I was able to perform that by using lookups at field level and

Although 'Application scope' variable is the best advised, 

I think session scope would satisfy my requirement.

Hope that works well.

Thanks for your advise. Much appreciated.  

Regards,

Harris.

Mar 8, 2017, 8:05 AM
589 Posts
.

glad you got it working.

 

If the values are for all users in the database then you'd typically want to use applicationScope.  If the values are user specific then year sessionScope is what you want to use.  Just remember that sessionScope is really more like "browserScope".  Meaning if you set a sessionScope variable and a user logs out and a different user logs back in right away values from the 1st user might survive if you don't clear and/or overwrite them yourself.

 

Dave


This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.