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



Sep 12, 2011, 7:22 PM
16 Posts

getColumnValues and Negative numbers

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 2
 Hi,
 I have a dojo column chart and I am using the following to get the values.
 
 var business = getComponent("business1").getValue()
if (business=="ABL"){ 
if (viewScope.Currency != null ) {
var keys=new java.util.Vector();
keys.add(viewScope.Currency);
keys.add("key1")
keys.add("key2")
var db:NotesDatabase = session.getDatabase("","db.nsf"); 
var CostCenterView:NotesView = db.getView("(Country5)")
var nav:NotesViewNavigator = CostCenterView.createViewNav();
var entry:NotesViewEntry = CostCenterView.getEntryByKey(keys);
entry = nav.getPrev(entry);
entry = nav.getPrev(entry);
if (entry == null) {
}
else {
var month1 = Math.round(entry.getColumnValues()[8]*Math.pow(10,2))/Math.pow(10,2);
var month2 = Math.round(entry.getColumnValues()[9]*Math.pow(10,2))/Math.pow(10,2);
var month3 = Math.round(entry.getColumnValues()[10]*Math.pow(10,2))/Math.pow(10,2);
var month4 = Math.round(entry.getColumnValues()[11]*Math.pow(10,2))/Math.pow(10,2);
var month5 = Math.round(entry.getColumnValues()[12]*Math.pow(10,2))/Math.pow(10,2);
var month6 = Math.round(entry.getColumnValues()[13]*Math.pow(10,2))/Math.pow(10,2);
var month7 = Math.round(entry.getColumnValues()[14]*Math.pow(10,2))/Math.pow(10,2);
var month8 = Math.round(entry.getColumnValues()[15]*Math.pow(10,2))/Math.pow(10,2);
var month9 = Math.round(entry.getColumnValues()[16]*Math.pow(10,2))/Math.pow(10,2);
var month10 = Math.round(entry.getColumnValues()[17]*Math.pow(10,2))/Math.pow(10,2);
var month11 = Math.round(entry.getColumnValues()[18]*Math.pow(10,2))/Math.pow(10,2);
var month12= Math.round(entry.getColumnValues()[19]*Math.pow(10,2))/Math.pow(10,2);
return result = month1 + "," + month2 + "," + month3 + "," + month4 + "," + month5 + "," + month6 + "," + month7 + "," + month8 + "," + month9 + "," + month10 + "," + month11+ "," + month12 
}
}
}
 
This works as long as the numbers in the columns are positive number. Creating a number array 1,2,3,4,5,6.... which I use for the dojo charts. 
However if one of the numbers is a negative in on of the column values I get
-1.3591E3,6655.8 vs -1359.1,66558 .  
 
Also if a single value the negative -1359.1 also.  Not sure why?   
 
 
Sep 12, 2011, 8:54 PM
16 Posts
Re: getColumnValues and Negative numbers
 Actually all of the code works it is only the concatenation that is the issue.  I tested with the following
 
var a = -1359.1 
var b = 6659.60 
return a + "," + b 
 
I get the below result 
 
-1.3591E3,6659.6
 
For some reason the negative is being converted. 
 
 
Sep 13, 2011, 1:07 PM
16 Posts
Re: getColumnValues and Negative numbers
 Ok, 
Figured it out.  I in the below was retrieving the columnvalues and artificially creating an array the the result.  This was converting all of my numeric values to strings causing the issue.  
        var month1 = Math.round(entry.getColumnValues()[8]*Math.pow(10,2))/Math.pow(10,2);
var month2 = Math.round(entry.getColumnValues()[9]*Math.pow(10,2))/Math.pow(10,2);
var month3 = Math.round(entry.getColumnValues()[10]*Math.pow(10,2))/Math.pow(10,2);
var month4 = Math.round(entry.getColumnValues()[11]*Math.pow(10,2))/Math.pow(10,2);
var month5 = Math.round(entry.getColumnValues()[12]*Math.pow(10,2))/Math.pow(10,2);
var month6 = Math.round(entry.getColumnValues()[13]*Math.pow(10,2))/Math.pow(10,2);
var month7 = Math.round(entry.getColumnValues()[14]*Math.pow(10,2))/Math.pow(10,2);
var month8 = Math.round(entry.getColumnValues()[15]*Math.pow(10,2))/Math.pow(10,2);
var month9 = Math.round(entry.getColumnValues()[16]*Math.pow(10,2))/Math.pow(10,2);
var month10 = Math.round(entry.getColumnValues()[17]*Math.pow(10,2))/Math.pow(10,2);
var month11 = Math.round(entry.getColumnValues()[18]*Math.pow(10,2))/Math.pow(10,2);
var month12= Math.round(entry.getColumnValues()[19]*Math.pow(10,2))/Math.pow(10,2);
return result = month1 + "," + month2 + "," + month3 + "," + month4 + "," + month5 + "," + month6 + "," + month7 + "," + month8 + "," + month9 + "," + month10 + "," + month11+ "," + month12 
 
 I changed it to create the array properly :)
 
var month = new java.util.Vector();
month.add(Math.round(entry.getColumnValues()[8]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[9]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[10]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[11]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[12]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[13]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[14]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[15]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[16]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[17]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[18]*Math.pow(10,2))/Math.pow(10,2))
month.add(Math.round(entry.getColumnValues()[19]*Math.pow(10,2))/Math.pow(10,2))

return result = month  
 

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