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



Dec 13, 2011, 7:33 PM
3 Posts

How To do Computed Open Selected Document Using

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags: open selected document using viewpanel computed
  • Replies: 4
Issue:
 
I have a view with forms. For two business reasons I cannot fully overhall the application to have one form and one xpage for one document.
 
The issue is that there are two web interfaces, one with a non oneui gui and another that is for staff. Historically I could have just one form say "WP" with different sets of fields for the web and notes users with each form hidden from either the Notes Client or the web. In another case, I create with one form, and then turn it into another document form upon staff edit. (think a quote request turning into an order). The result is that we have a mixed bag of very related documents in a single view which use as many as 5 different forms. (which should stay together as it makes sense to keep them all together in one view).
 
Obviously I could make a separate view for each form and then do the hardcoded option but that's just awful and clunky.
 
I don't have the liberty (unlimited time, mandate, and budget) to start over and create a one-to-one mapping of form to XPage for all users to share one interface. So I CANNOT use the property/option in the for the field "at runtime, open selected document using"--> "XPage associated with the document's form".
 
I need something (aka code) that says:
if the current document's rowdata.field.form = "wp", then use xpage: xWP
if the rowdata.field.form = "wq", then use xpage: xWQ
if the rowdata.field.form = "wl", then use the xpage: xWL.
... etc....
 
However, I haven't found anything (aka code) I write yet that will do that readily without actually abandoning this field and hacking in manual URLs in a view column instead. I'd much rather work "with the product" if I can simply click the make column a link checkbox and write some computed code for this field instead. 
 
Has anyone done this yet? It seems like it would be very simple if I just figured out what the "hook" is.
 
Thanks,
Tripp
Dec 13, 2011, 7:47 PM
17 Posts
Re: How To do Computed Open Selected Document Using
view property: At runtime open selected doc using. You can use any calculation there. or I'm missing something?
Dec 13, 2011, 11:32 PM
3 Posts
Re: How To do Computed Open Selected Document Using
Hi Normunds,
 
Yes, that's exactly the spot. Thanks.
The question is what code there actually works?
 
Thanks,
Tripp
 
Dec 14, 2011, 6:45 AM
129 Posts
Re: How To do Computed Open Selected Document Using
If you have several views, create a function that returns the correct XPage so that you maintain the logic in one place.
 
Also, if the naming is consistent with your example:
 
// in function 
return '/x' + currentDocument.getValue( 'Form' ).toUpperCase() + '.xsp'
Dec 14, 2011, 5:24 PM
3 Posts
Re: How To do Computed Open Selected Document Using
Hi Tommy,
 
Thanks for the answer. My viewPanel didn't have a currentDocument object to latch on. However, It did get me thinking about using the default viewEntry var for the viewPanel (equivalent to var=rowData in the Mast. XPages book) , so I ended finding that this works:
 
var curDoc = viewEntry.getDocument();
return 'x' + curDoc.getItemValueString('Form') + '.xsp';

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