On Datorama when trying to get the length of an array I'm able to get it using a calculated dimension by:

 a = SPLIT([Media_Buy_Name],'_')
 return EXTRACT(a[a.length-1],'&',0)

But when using the formula editor inside the mapping tool, the same code is not working : class not found: java.lang.Object$length

  • What if there's only one element in the array -- a? Even if it's not syntactically correct, it would be problematic. May 4 at 20:38

1 Answer 1


You could do something like this, where str is [Media_Buy_Name]:

str = 'this_is_a_test_whee&whoa&whoop';
arr = SPLIT(str,'_');
b = arr.length;
if (b > 0) {  
  return EXTRACT(arr[b-1],"&",0)
} else {
  return str

I validated this in Datorama and it returned:



According to one of my astute co-workers, your original expression was missing a semicolon. This'll return the same results as my expression above.

a = SPLIT('this_is_a_test_whee&whoa&whoop','_');
return EXTRACT(a[a.length-1],'&',0)
  • Thanks to the co-worker :D
    – mario ruiz
    May 6 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.