Expand my Community achievements bar.

SOLVED

Padding an ID in workflow

Avatar

Level 1

Hi,

I have a workflow that I am running in campaign that is reading values from a file and putting them in a temp table. The data I am reading has a customer ID, is there a way to pad this customer ID with zeros within the workflow? Like running a javascript, or what will be the best way to achieve this?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi 2DF-MSD,

You can certainly achieve that with the help of an enrichment activity on a workflow.

You can use the formula

LPad(<‘attribute that needs padding’>, <Number of characters in the final string after padding is applied>, <‘Character to use for padding at the BEGINNING if input text is smaller in length as compared to final output you want’>)

Or use

RPad(<‘attribute that needs padding’>, <Number of characters in the final string after padding is applied>, <‘Character to use for padding at the END if input text is smaller in length as compared to final output you want’>)

So in my test workflow I used

  • LPad([target/@account], 10, '0')
  • RPad([target/@account], 10, '0')

1479433_pastedImage_4.png

And here is the output

1479437_pastedImage_5.png

Regards,
Vipul

View solution in original post

1 Reply

Avatar

Correct answer by
Employee

Hi 2DF-MSD,

You can certainly achieve that with the help of an enrichment activity on a workflow.

You can use the formula

LPad(<‘attribute that needs padding’>, <Number of characters in the final string after padding is applied>, <‘Character to use for padding at the BEGINNING if input text is smaller in length as compared to final output you want’>)

Or use

RPad(<‘attribute that needs padding’>, <Number of characters in the final string after padding is applied>, <‘Character to use for padding at the END if input text is smaller in length as compared to final output you want’>)

So in my test workflow I used

  • LPad([target/@account], 10, '0')
  • RPad([target/@account], 10, '0')

1479433_pastedImage_4.png

And here is the output

1479437_pastedImage_5.png

Regards,
Vipul