Add zeros before a field in Data Schema | Community
Skip to main content
CampaignerForLife
Level 5
April 24, 2024
Solved

Add zeros before a field in Data Schema

  • April 24, 2024
  • 1 reply
  • 870 views

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

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 Heku_

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.

1 reply

Heku_
Heku_Accepted solution
Level 5
April 24, 2024

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.

CampaignerForLife
Level 5
April 24, 2024

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

Heku_
Level 5
April 24, 2024

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/filtering-data/list-of-functions