Expand my Community achievements bar.

Join Cristinel Anastasoaie, Timothy Furlow, and Brent Kostak, WEDNESDAY, 2/28/24 @8am PT for the next Adobe Target Community Q&A Coffee Break on topics from the recent High Performance Recommendations Webinar PT 2 of the ongoing Target Personalization Maturity Webinar Series
SOLVED

How do I get a substring of an entity property in my design?

Avatar

Level 1

I'm able to use the replace method on an entity property:

 

#set ($pageUrl = $entity1.pageUrl.replace(".com", ".org"))

 

I want to get a substring of the property also.  Specifically, I want to insert characters before a trailing slash.  I'm wanting to do something like this:

 

#set ($pageUrl = "$entity1.pageUrl.substring(0, $entity1.pageUrl.length()-1).new/")

 

Can this be done somehow?  If so, where's it documented?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 1

I'd probably need to add braces like this:

#set ($pageUrl = "${entity1.pageUrl.substring(0, $entity1.pageUrl.length()-1)}.new/")

Alternatively, something like this would be nice:

#set ($pageUrl = "$entity1.pageUrl.replaceAll('/$', '.new/')")

View solution in original post

1 Reply

Avatar

Correct answer by
Level 1

I'd probably need to add braces like this:

#set ($pageUrl = "${entity1.pageUrl.substring(0, $entity1.pageUrl.length()-1)}.new/")

Alternatively, something like this would be nice:

#set ($pageUrl = "$entity1.pageUrl.replaceAll('/$', '.new/')")