Expand my Community achievements bar.

Segment or Filtering on character amount

Avatar

Level 1

I have a sku dimension that either has 6 or 7 digits. Is there a way to filter or create a segment that conditions I only want to see skus within the dimension that are 7 digits long? 

9 Replies

Avatar

Community Advisor

I am not aware of any sort of "length" condition in the segment builder, but you could potentially use Classifications on your dimension, and use regex rules to set up a "length of sku" classification.

 

You could then create a segment based on the classification length.

 

 

Regex for length of 6:
^(.){6}$

 

Regex for length of 7:

^(.){7}$

 

(basically, look for any character except line breaks, with the specified length {x}, and start from the beginning of the string to the end of the string (so that {6} doesn't match both the 6 and 7 lines.

 

Classifications will process every 4-6 hours, so this won't work if you need the data immediately, but if you are reporting based on yesterday or earlier, you should be fine... Classifications will also apply backwards up to 6 months.... so this should cover a lot of your needs (you just need to wait about 24 hours for the initial rule setup to finish processing upon setting this up)

Avatar

Community Advisor

@Jennifer_Dungan I feel like this is an opportunity for improvement in the area of functions within the calculated metrics or the comparisons within segments themselves.  It's a simple function in Excel, so why not have it as a function in Adobe Analytics as well, right?
@ChristineNe1 If anything, I would recommend putting an idea around adding new functionality around this very specific challenge in the ideas section and see if we can get some traction.

Jeff Bloomer

Avatar

Community Advisor

I agree, this functionality would be great to have... but waiting for a new feature won't help in the "now".

I will definitely upvote such a suggestion.

Avatar

Community Advisor

Of course, we all know just how quickly Adobe adds functionality, but it never hurts to get things going on the ideas front. 

Jeff Bloomer

Avatar

Community Advisor

If the SKU is an integer datatype, you could try using Greater Than / Less Than functions.  If Greater Than 999999 = 7 digit SKUs.  Less Than 1000000 = 6 digit SKUs.

Avatar

Community Advisor

Unfortunately in Adobe Analytics, even if the value looks like a number (i.e. 9999999), it's still stored as text, so you can't apply "greater than" or "less than" logic to them... 

 

CJA however, I believe you can set up data types.

Avatar

Community Advisor

It's too bad... that would be a really elegant solution!

Avatar

Community Advisor

Although data types can be a bit messy in CJA if they don't match what you want. Integers show up with thousands separators which can be a bit wonky.

And I've got another use case where a stakeholder would like to know some averages for several scenarios.  And those dimensions are string datatype so no easy way to use math functions.  

Wouldn't it be nice if CJA had a way to cast to different data types?