Expand my Community achievements bar.

Join us for the Adobe Journey Optimizer Community Q&A Coffee Break on 1st October at 8 am PT with Journey Optimizer experts Amarnath Vannarath, Ariel Sultan, Arthur Lacroix and Sandra Hausmann.
SOLVED

How to get the last 4 digit from a string in AJO

Avatar

Level 2

I have to get the last 4 digit from the account number. How to achieve that in the AJO

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Employee

You can validate it on the following lines 

{%= substr(toString(<ReplaceWithAccountNumber>), length(toString(<ReplaceWithAccountNumber>))-4, length(toString(<ReplaceWithAccountNumber>))) %}

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

You can validate it on the following lines 

{%= substr(toString(<ReplaceWithAccountNumber>), length(toString(<ReplaceWithAccountNumber>))-4, length(toString(<ReplaceWithAccountNumber>))) %}

Avatar

Level 1

Hello @NiteshSingh ,

 

If your usecase is to display the last 4 digits of account number by masking it. we have below mask function,

 

{%= mask("123443216789",0,4) %}

  - this function will keep last 4 digits as it is and mask the remaining as X.

 

Output - XXXXXXXX6789

 

If your usecase is to get last 4 digits for other calculation you can refer the code suggested by @dugganab