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-07-2018 09:45 AM
Hi Jeff. I think you just need to make two small changes - to bucket group and your script.
For the bucket group, try this:
And for the script:
var result;
if ((current.u_peer_bundle == 0))
result = 1;
else result = 2;
result;
I'm not an expert on scripting so please let me know if it doesn't work.
Regards,
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-07-2018 10:05 AM
Don't mask the problem in PA. Fix the data in the base table (most likely by adding a true/false field). This will allow you to simplify your breakdown but also allow you to use this:
- In reporting
- As an interactive filter
- In a Business Rule
- Any place else you may need it in the platform
If you have no other options, you should be able to fix your bucket definitions. It should be null/blank to 1 and then 1 to null/blank.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2018 07:58 AM
Thank you for the reply Adam. Actually, there are reasons why I cannot add a field to the table. I would need to go down a change control route to edit the table, and we are on a partial freeze in that regard. I can however do whatever I wish with PA.
I tried changing the bucket group to null - 1 and then 1 - null, but get similar non-results when running a collection (no scores).
Thanks!
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2018 08:37 AM
1) Taking the shortcut by using a script is fine for a quick response, but it is not a good long-term solution. As long as you are OK with, let's get it to work.
2) What does your entire script look like? It looks like you put in just a snippet of it.
3) Put in some gs.log() statements to make sure you are getting what you think you are getting in your script.