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



May 26, 2011, 4:13 PM
35 Posts

Re: Open personal xPage document by default

  • Category: Other
  • Platform: Linux
  • Release: 8.5.2
  • Role: End user,Developer,Administrator
  • Tags:
  • Replies: 4
Rami, Richard,
 
I big thank you for the precious help you gave me... 
 
Rami, you put me on the right way, I tested with code in the beforepageload of my xpage, I added the next piece of code to compute the documentID to open:

var db:NotesDatabase = session.getCurrentDatabase();

var vw:NotesView = db.getView('(vwU)');

var userDoc:NotesDocument = vw.getDocumentByKey(@Name('[CN]',@UserName(0)));

return userDoc.getUniversalID(); 

It works great, except that it generates an error when document does not exists, I then tried to add try / catch, without result...

===================== 
===================== 
 
Richard, 
You're right, your piece of code is just perfect... also much better using distinguished name!
I also try to understand : 

(nve == null)?null:nve.getUniversalID()

Means IF nve = null then null else nve.getUniversalID, I'm I right? this correspond to a shorter way of writing an if close... sorry for my lack of knowlegd, I just start with xPages and java.
 
Thank you very much! 
 
Best regards, 
 
Chris 
 
May 27, 2011, 3:50 PM
47 Posts
Re:conditional operator
Yes Chris, that is known as the conditional operator or ternary operator (because it is usually the only 3 operand operator) and is available in many languages. It is a very useful shortcut for if(clause){value1}else{value2}.
 
If you return null for the documentID for a data source, it will switch from edit to create document mode. 
 
Glad to be of some assistance, 
 
Rich 

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