Expand my Community achievements bar.

SOLVED

Add zeros before a field in Data Schema

Avatar

Level 7

Hello, I would like to know if there's an easy way to add zeros before a field in adobe campaign

 

For example:

If the record is equal to "4", it will show 0004

if the record is equal to "32" it will show 0032

 

 

Thank you in advance

1 Accepted Solution

Avatar

Correct answer by
Level 7

Hello, check the function LPad -> To fill with 0s at the left of the number you can use: LPad(@field, 4, '0').

With this, you will have 4 digits, with 0s at the left.

View solution in original post

3 Replies

Avatar

Correct answer by
Level 7

Hello, check the function LPad -> To fill with 0s at the left of the number you can use: LPad(@field, 4, '0').

With this, you will have 4 digits, with 0s at the left.

Avatar

Level 7

Hello Heku, just to make it clear, if I add that expression, the value will be filled with 0 until the 4th character?

 

Thank you in advance

Avatar

Level 7

Yes, if you have 4 digits in your field, it will remain the same, if you have 1 digit it will be filled with 3 0s at the left. For more info you have here a list of all database functions and how to use them: https://experienceleague.adobe.com/en/docs/campaign-standard/using/managing-processes-and-data/filte...