Adding a prefix 0 (zero) to the Employee ID

Mike Kiser 1,531 Reputation points
2021-02-25T16:08:33.543+00:00

Hello!
I have a situation where the Employee IDs returned from a Looking Activity have to be 6 characters long. However , some of the Employee IDs must begin with a Zero if they are 5 characters long (please see below) . In the case below the EMPL_ID that is 10042 should be 010042 and I use it in the url to look like
72201-image.png

How can I count the EMPL_ID once it has been retrieved to see if it is 6 chars or 5 chars? and then if it is 5, I have to add a zero to precede the 5 character EMPL_ID?

72154-image.png

Thanks!
MIke
@Nasreen Akter

72130-screenshot-2021-02-25-095701.jpg

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,517 questions
{count} votes

Accepted answer
  1. Nasreen Akter 10,736 Reputation points
    2021-02-25T17:58:58.97+00:00

    Hi @Mike Kiser ,

    Please try the following expression. Thanks!

    @concat('https://battelle-dev-services.azure-api.us/employees/v1/', if(equals(length(item().EMPL_ID), 5), concat('0', item().EMPL_ID), item().EMPL_ID))  
    

    ----------

    If the above response is helpful, please accept as answer and up-vote it. Thanks!

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful