Expand my Community achievements bar.

Join us at Adobe Summit 2024 for the Coffee Break Q&A Live series, a unique opportunity to network with and learn from expert users, the Adobe product team, and Adobe partners in a small group, 30 minute AMA conversations.
SOLVED

How to set dynamic values in Classification

Avatar

Level 2

Hello,

 

I have a variable I want to apply Classification to.

 

The format will be something like : %CountryCode%-Homepage-%LanguageCode% (just an example)

 

Where %CountryCode% and %LanguageCode% are dynamically sent by the developers. (ex : FR-Homepage-FR)

 

I want to use the classification to KEEP the dynamic values and change the value in the middle only - to have something like this : 

 

%CountryCode%-HP-%LanguageCode%

 

Is this possible in Classification Rule Builder ? 

I want it to be a classification because I want it to be retroactive to old values.

 

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 8

@prahme  -

It certainly is possible. You'll just have to use a regex match in the rule, then reassemble the parts to build the string you want to see in reports. Your regex may vary, but the simplest approach would be something like the following:

evolytics_brian_2-1603721790073.png

 

This assumes we're looking for the "Homepage" value, you always have three (3) parts to the value coming in, and there are only two (2) dashes/hyphens in the string. The leading "(?i)" ensures this is a case-insensitive search (so both "Homepage" and "homepage" would match). The result should be four (4) total match groups, with $0 always representing the original value as shown in the sample image above. 

To stitch it back together, you can reference the match groups to keep the dynamic values. In the example, this would be $1 for the leading "FR" and $3 for the trailing "FR". In the middle, you can use a literal string, such as "HP" to complete the updated/classification value:

evolytics_brian_3-1603721948686.png

With this approach, you'll have to build a rule for every variation you expect to find in the middle ($2) position of the original string. However, the leading (CountryCode) and trailing (LanguageCode) values do not have to be anticipated because we're using a wildcard to match the strings.

 

View solution in original post

2 Replies

Avatar

Correct answer by
Level 8

@prahme  -

It certainly is possible. You'll just have to use a regex match in the rule, then reassemble the parts to build the string you want to see in reports. Your regex may vary, but the simplest approach would be something like the following:

evolytics_brian_2-1603721790073.png

 

This assumes we're looking for the "Homepage" value, you always have three (3) parts to the value coming in, and there are only two (2) dashes/hyphens in the string. The leading "(?i)" ensures this is a case-insensitive search (so both "Homepage" and "homepage" would match). The result should be four (4) total match groups, with $0 always representing the original value as shown in the sample image above. 

To stitch it back together, you can reference the match groups to keep the dynamic values. In the example, this would be $1 for the leading "FR" and $3 for the trailing "FR". In the middle, you can use a literal string, such as "HP" to complete the updated/classification value:

evolytics_brian_3-1603721948686.png

With this approach, you'll have to build a rule for every variation you expect to find in the middle ($2) position of the original string. However, the leading (CountryCode) and trailing (LanguageCode) values do not have to be anticipated because we're using a wildcard to match the strings.