 Level 1

0% to Level 2

Tip /

to gain points, level up, and earn exciting badges like the new
Mission!

View all

## Calculations with numbers stored as text in s.eVar Level 4

Likes

54 likes

Total Posts

82 posts

16 solutions
View profile

Level 4

Likes

54 likes

Total Posts

82 posts

16 solutions
View profile Level 4

31-05-2020

My client captures price in an s.eVar, and I am trying to figure out if there is a way to use the captured value in mathematical operations within Adobe Analytics. I can export the data and treat the text string as a number using Python or other programming approaches, but would like to be able to handle this within Adobe because I could include calculations in Workspace. Since numeric classifications have been removed, I'm not sure if what I want is even possible. Does anyone have a recommendation for this? View Entire Topic AndrewWathen
MVP

Likes

574 likes

Total Posts

320 posts

15 solutions
View profile

AndrewWathen
MVP

Likes

574 likes

Total Posts

320 posts

15 solutions
View profile
AndrewWathen MVP

02-06-2020

I can see how you could potentially do this using a combination of regex in the classification rule builder and a calculated metric.  It's pushing the limits of what is achievable but it might just be do-able...

For the sake of explaining the concept let's simplify things by make the (false) assumption that your products range in value from \$1 to \$999 and are in whole numbers (you'll need to expand the concept to cover other values!).

First Stage: classifications

create 3 classifications, one for the units, one for the tens, and one for the hundreds.

Then use regex in the rule builder to dynamically split the value into the 3 classifications.  Your regex is going to look something like this:

For the units (^\d*)(\d\$) returning \$2

For the tens (^\d*)(\d)(\d\$) returning \$2

For the hundreds (^\d*)(\d)(\d)(\d\$) returning \$2

For example if the value was 874 then:

"units" classification would be dynamically set to "4"

"tens" classification would be dynamically set to "7"

"hundreds" classification would be dynamically set to "8"

Second Stage: calculated metric

You've now got to build a calculated metrics along the lines of:

If "unit" equals "1" static number 1

Plus

If "unit" equals "2" then static number 2

Plus

If "unit" equals "3" then static number 3

.

.

.

Etc. (all the way to 9)

Plus

If "tens" equals "1" then static number 10

Plus

If "tens" equals "2" then static number 20

Plus

If "tens" equals "3" then static number 30

.

.

.

Etc. (all the way to 90)

Plus

If "hundreds" equals "1" then static number 100

Plus

If "hundreds" equals "2" then static number 200

Plus

If "hundreds" equals "3" then static number 300

.

.

.

Etc. (all the way to 900)

Obviously in the real world you'll need to expand the concept for more digits.

It's pretty crazy but I think it would work.  Let me know if you try it! That's an interesting approach. I had already created classifications for price groupings (e.g. \$250, \$500, etc. increments), and with prices up to \$100,000 I may increased create these calculated metrics by group. Not quite the ideal, but it's worth experimenting with. Hopefully Adobe figures out a replacement for numeric classifications. I've used a very similar approach to make Calculated Metrics based on Survey scores that have a possible range of 0 to 100; have to admit that I didn't come up with the additional step of converting into Units / Tens / Hundreds, which will save me some tedium next time! One additional point: it may be worth "seeding" the values using Classification Importer (e.g., make a sheet with all of the values from \$1 to \$100000 and upload it) rather than the Classification Rule Builder approach. If you have decimals and are willing to forego that level of precision, use Classification Rule Builder to discard the decimal then "sub-classify" using Classification Importer as laid out here.