Expand my Community achievements bar.

Never miss an update of the Adobe Journey Optimizer Community Lens! Subscribe now to get the latest updates, insights, and highlights delivered straight to your inbox every time a new edition drops.
SOLVED

How to do math addition in expression

Avatar

Level 7

Hi community,

 

This is such a silly question yet I can't figure it out. How do you do addition in an expression? 

 

I am trying to find the index of a specific parameter in a given string, then +x to the index number so that I can remove the parameter key name.

 

For example:

String: https://www.testsite.com?identifier=12345

 

I wrote an expression to:

substr(@{testsite.web.webPageDetails._tenantID.queryString}, (indexOf(@{testsite.web.webPageDetails._tenantID.queryString}, 'identifier=')) +11)

 

So I want the numbers after identifier= (hence the +11), but I am getting this issue: The expression is invalid : You cannot use the character '+' like this because it is a keyword of the language. Please, add quotes to fix your expression.

 

How do you do simple math in an expression in AJO?

 

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor
2 Replies

Avatar

Correct answer by
Employee Advisor

@akwankl 

This expression works.

substr('https://www.testsite.com?identifier=12345', (indexOf('https://www.testsite.com?identifier=12345', 'identifier='))+11)  

dugganab_0-1702952876184.png

 

Avatar

Level 7

Thanks, not sure what went wrong but probably cause the bracket was throwing me off.