web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do I maintain proc...
Power Apps
Answered

How do I maintain proceeding zeros in a text field value?

(0) ShareShare
ReportReport
Posted on by 831 Moderator

I just noticed a bug that I need to fix. I have an ID text control that checks to see if you entered a 7 digit number. It works only if your 7 digit value does not start with a zero. For example 0000001 would be a number I would want to enter but that field validation sees only the 1. Is there a way to alter this code so it sees the starting zero and count from there? 

 

 

If(
 Value(Self.Text) < 1000000 || Value(Self.Text) > 9999999,
 Reset(Self);
 Notify("Reference ID Should be 7 digits. Drop any letters.")
)

 

 

Categories:
I have the same question (0)
  • Verified answer
    Rajkumar_M Profile Picture
    3,747 Moderator on at

    Hi @futr_vision 

     

    Try these formulas,

     

    If(
    Len(Self.Text) <> 7 || !IsNumeric(Self.Text),
    Reset(Self);
    Notify("Reference ID should be 7 digits and contain only numbers.")
    )

    (Or)

     

    If(
    Len(Self.Text) <> 7 || !IsMatch(Self.Text, "^\d{7}$"),
    Reset(Self);
    Notify("Reference ID should be exactly 7 digits.and contain only numbers..")
    )

     

    Thanks!

     

    If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.

  • MarkRahn Profile Picture
    1,424 Super User 2026 Season 1 on at

    Hi  @futr_vision 

     

    The following should work using IsMatch and a regular expression.

     

    If(
     !IsMatch(Self.Text, "^(?=.{7}$)[0-9]+$"),
     Reset(Self);
     Notify("Reference ID should be 7 digits. Drop any letters.")
    )
    

    This checks to make sure the value is a 7 digit number and is exactly 7 digits.

     

    -Mark

    If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up.

  • MarkRahn Profile Picture
    1,424 Super User 2026 Season 1 on at

    Good job @Rajkumar_404 ! You got to it just before I did.

    -Mark

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 337 Most Valuable Professional

#2
11manish Profile Picture

11manish 173

#3
Valantis Profile Picture

Valantis 86

Last 30 days Overall leaderboard