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



Jul 3, 2013, 7:58 PM
453 Posts
topic has been resolvedResolved

Best Practice on using Scoped Variable

  • Category: Performance
  • Platform: All
  • Release: 9.0
  • Role: Developer
  • Tags: scoped variable
  • Replies: 2

There are two ways to read or set a Scoped Variable:

viewScope.get("MyViewScopeVariable") == Something ? true : false

viewScope.MyViewScopeVariable == Something ? true : false

They both seem to work equally well, my question is "Is one method more efficient than the other?"

It might be a pretty small difference between the methods but if one is better then might as well standardize on the best one.

 

 

Jul 5, 2013, 8:43 PM
170 Posts
The best way is to use

The get and put methods for scoped variables because.

your name can be confusing for the JS engine. I.e you have the same name as an variable. 

 

My advice is use get/put it's the same as in LotusScript where you should use replaceitemvalue/getitemvalue.

/Fredrik

www.xpagedeveloper.com

Jul 8, 2013, 7:17 PM
586 Posts
my thoughts

I prefer to use puts and gets also for dealing with scoped variables.  I try and avoid using the shortcut dot notation.

 

 


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