How to do math addition in expression | Community
Skip to main content
Level 6
December 19, 2023
Solved

How to do math addition in expression

  • December 19, 2023
  • 1 reply
  • 806 views

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.

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

@akwankl 

This expression works.

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

 

1 reply

Mohan_Dugganab
Adobe Employee
Mohan_DugganabAdobe EmployeeAccepted solution
Adobe Employee
December 19, 2023

@akwankl 

This expression works.

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

 

akwanklAuthor
Level 6
December 19, 2023

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