Skip to main content

Notifications

Community site session details

Community site session details

Session Id : K6FruEfDC+LFiXdzvWBmG0
Power Apps - Building Power Apps
Answered

Pad value with fixed number of leading zeros

Like (0) ShareShare
ReportReport
Posted on 2 Nov 2023 11:54:09 by 170

I have an employee ID that is being pulled in and it can be any length of numbers.  99% of the time, the number is five digits, but I am needing to accommodate for the possibility of four or six characters also.  The data connector (API) that I am writing data to is expecting the value to be 8-characters long with leading zeroes.  I am sure I need to use the Text() function, and I am sure I can check the length of the value and use if statements.  Just wondering if there is an easier or better way to to do this.

 

Thanks

Categories:
  • PowerStudent Profile Picture
    150 on 02 Nov 2023 at 12:03:05
    Re: Pad value with fixed number of leading zeros

    Hi,

    Sure..!  you're welcome 🙂
    you can save my mail for future help


    For more detailed support, book a consultation call with me here:
    Consultation: https://softwarezone365.com/contact-us
    PowerApps Blogs: https://softwarezone365.com/power-apps


    Should you appreciate my assistance and wish to support my work, you might consider:
    Giving this post a Thumbs Up.
    If applicable, marking it as the Solution.


    Support my work:
    PayPal: https://www.paypal.com/donate/?hosted_button_id=DASYHQAEETD2J


    Contact directly:
    Email: Contact@SoftwareZone365.com
    WhatsApp: https://wa.me/+923087478066


    Best regards,
    Ahmad Raza

  • CMSGuy Profile Picture
    170 on 02 Nov 2023 at 12:01:19
    Re: Pad value with fixed number of leading zeros

    Really?  That simple?  Thanks for the reply!  Have a great day

  • Verified answer
    PowerStudent Profile Picture
    150 on 02 Nov 2023 at 11:58:35
    Re: Pad value with fixed number of leading zeros

    Hi,

    In Power Apps, you can pad a number with leading zeros using the Text function to format it as a string with a specific number of digits. Here's how you can ensure your employee ID is always 8 characters long with leading zeros:

    Text(employeeID, "00000000")

    This will automatically add leading zeros to your employee ID to make it 8 digits long. For example, if employeeID is 12345, it will become 00012345. This is a simple and efficient way to achieve the padding without using if statements to check the length.


    For more detailed support, book a consultation call with me here:
    Consultation: https://softwarezone365.com/contact-us
    PowerApps Blogs:
    https://softwarezone365.com/power-apps


    Should you appreciate my assistance and wish to support my work, you might consider:
    Giving this post a Thumbs Up.
    If applicable, marking it as the Solution.


    Support my work:
    PayPal: https://www.paypal.com/donate/?hosted_button_id=DASYHQAEETD2J


    Contact directly:
    Email: Contact@SoftwareZone365.com
    WhatsApp: https://wa.me/+923087478066


    Best regards,
    Ahmad Raza

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 298 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 169

#3
stampcoin Profile Picture

stampcoin 130

Overall leaderboard
Loading started