Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Keeping Leading Zeros from Forms

Like (0) ShareShare
ReportReport
Posted on 9 Dec 2022 14:11:04 by 83

I have a form that asks for an ID number that should contain two leading zeros. How do I ensure that the leading zeros remain when building my flow? I would like to verify that the user submitted exactly a nine-digit number and that they keep the leading zeros if they input them that way. I do not wish to exclude numbers that don't have leading zeros. 

  • Verified answer
    Ellis Karim Profile Picture
    11,004 Super User 2025 Season 1 on 09 Dec 2022 at 15:56:58
    Re: Keeping Leading Zeros from Forms

    The following example should help:

     

    ekarim2020_0-1670601218853.png

     

    Your condition would be similar to the following:

    Snag_e8636cb.png

     

    I'm using the string function for 00 and 900 so that flow doesn't flag error that I'm trying to compare a string to an integer value.

     


    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

  • dedgerton1 Profile Picture
    83 on 09 Dec 2022 at 15:01:42
    Re: Keeping Leading Zeros from Forms

    Would it be 3 separate "equals" rows under one condition? And do I replace your instance of 001234567 with Compose Output? These IDs could also start with "900," so how do I ensure that I'm not excluding those?

  • Ellis Karim Profile Picture
    11,004 Super User 2025 Season 1 on 09 Dec 2022 at 14:32:27
    Re: Keeping Leading Zeros from Forms

    Hi @dedgerton1 

     

    One option could be to treat the ID as a string.

     

    You could then check if the ID starts with '00', that the length of the ID is 9 and that it is an integer using expressions and the Condition action:

     

    isInt('001234567')

    length('001234567')
    startsWith('001234567', '00')
     

    Ellis
    ____________________________________
    If I have answered your question, please mark the post as Solved.
    If you like my response, please give it a Thumbs Up.

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 >

Loading started