Quantcast
Channel: SCN : All Content - SAP BusinessObjects Design Studio
Viewing all articles
Browse latest Browse all 4216

Using a VAR in getData Statement

$
0
0

Hi All,

 

Does anyone know why this works:-

 

var TW = "36" ;

 

// Calculate the Shopper Stats

var ITEM_VAR = SHOPPER_STATS.getData("BASKET_ITEM_AVG", {"WEEK_NUM": TW }).value

 

But when I try to use a variable such as

 

// Get the max week

var WEEK_ARRAY = SHOPPER_STATS.getMembers("WEEK_NUM", 300) ;

var MAX_WEEK = 0 ;

WEEK_ARRAY.forEach(function(element, index) {

  if (Convert.stringToInt(element.text) > MAX_WEEK) {

  MAX_WEEK = Convert.stringToInt(element.text) ;

  }

}) ;

 

// Set this week and last week

var TW = MAX_WEEK+"" ;

 

// Calculate the Shopper Stats

var ITEM_VAR = SHOPPER_STATS.getData("BASKET_ITEM_AVG", {"WEEK_NUM": TW }).value

 

I get the error "Wrapped java.lang.NullPointerException: while trying to invoke the method java.lang.String.startsWith(java.lang.String) of a null object loaded from local variable 'memberKey'"

 

I have put TW into an alert and the number is shows me is 36 so I know that is the same.

 

Cheers,

 

James.


Viewing all articles
Browse latest Browse all 4216

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>