Bucket Group and Scripted Automated Indicator- Breakdown for empty vs. not empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2018 08:55 AM
Hello Community!
I am trying to create a breakdown for a group of existing indicators that will separate based on whether a field is empty or not. This is currently a text field, so it is not something I can use a normal breakdown for and have tried using a bucket group. I do not want to create additional indicators and stack them as there are many, and I am already doing some stacking- the breakdown method will be cleaner, but I think I am missing a step or just have a bad script.
I created a bucket group-
I created a breakdown source-
And finally I created an automated breakdown-
Unless I am missing a step, which is entirely possible, I think the problem is likely my script since I am a scripting neophyte- I have tried to create this based on what is OOB and some googling.
function empty() {
if (!u_peer_bundle)
return '0';
else
return '1';
}
When I run a collection, nothing is sorted into either the 0 or 1 buckets. Hoping it is something easy, or if someone has a better idea. Thanks!
Jeff
- Labels:
-
Dashboard
-
Performance Analytics
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2018 08:50 AM
Thanks Adam! I actually just got it working by tweaking the bucket group to have numerical gaps; I swear the 0-1 1-0 thing was giving me the opposite expected answers for a bit, so I gave them gaps. I also changed the script slightly though I am unsure if any of this was necessary. Pretty sure I was shotgunning the fixes and got lucky. Running the collections on all the indicators for final confirmation, but it is coming out how I want now.
var empty=function(x) {
if (x == '')
return '2';
else
return '5';
};
empty(current.u_peer_bundle);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2018 08:54 AM
Instead of
if (x == '')
use
if (gs.nil(x))
That will handle nulls as well.