Segment or Filtering on character amount | Community
Skip to main content
July 15, 2024
Question

Segment or Filtering on character amount

  • July 15, 2024
  • 2 replies
  • 1483 views

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? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 15, 2024

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)

jeff_bloomer
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 16, 2024

@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.

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 17, 2024

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.

Josh Stephens
Community Advisor
Community Advisor
July 30, 2024

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.

Jennifer_Dungan
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
July 30, 2024

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.

Josh Stephens
Community Advisor
Community Advisor
July 30, 2024

Good call.  Thanks for correcting me! 🙏