cancel
Showing results for
Did you mean:
Impactful Individual

## checking the length of a number even with a decimal

I have a textbox on form. Set to only accept a number.

In the "OnChange"  i would like to notify folks you can only enter  9 digits. If they enter more than 9 digits.

Problem: they copy and paste(or type) a number  that looks like

1234567895444.000000  I still need to let the person know they have entered more than 9 digits.

the length of the number cant be over 9 digits prior to the decimal if it includes a decimal.

Dave

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

Sorry I need to try to re write that and test it and i puzzle my self for a moment 🙂

``````If(
IsNumeric(Self.Text),
If(
Len(
Left(
Self.Text,
If(
Find(".", Self.Text, 1) > 0,
Find(".", Self.Text, 1) - 1,
Len(Self.Text)
)
)
) > 9,
Notify(
"Please enter a number with no more than 9 digits",
),
Notify(
"Valid number",
)
),
Notify(
)
)``````

try this approuch and see if it will work  for you

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
14 REPLIES 14
Community Champion

Why not use a text input field and use the MaxLength attribute? This will limit input to whatever you want it to be. This will count the decimal as one input so if you want to allow 9 digit number then you will need to put 10 as the max.

If this post solves your issue please mark it as a solution.
Super User

Try this one I put Self.Text as You want to use this in OnChange, but if You want to use it outside of the input text change it to the name of the control

``````    IsNumeric(Self.Text),
If(
Len(Left(Self.Text, Find(".", Self.Text, 1) - 1)) > 9,
),
)``````

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
Impactful Individual

@mmollet ,  Thanks for the reply , I really can't use the decimal or anything digits after that as part of the equation.

Impactful Individual

@SebS , Getting an syntax error on comma's.

Super User

Can you let me know what error You have and Screen.

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
Impactful Individual

error as seen in the pic.

Thanks for checking.

dave

Community Champion

Looks like you may be missing a ';' between two statements or something. You go from IsNumeric to If(....) and there needs to be either a ',' or a ';' or something there to let Power Apps know that they are different and to what function call they belong to.

If this post solves your issue please mark it as a solution.
Impactful Individual

Thanks mmollett..  still an error on the Left function

Super User

Sorry my fault I eat If statement than I was off few days and could not replay

``````If(IsNumeric(Self.Text),
If(
Len(Left(Self.Text, Find(".", Self.Text, 1) - 1)) > 9,
),
)``````

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.

Announcements

#### Power Platform Connections Ep 15 | L. Baybutt | Thursday, 1 June 2023

Episode Fifteen of Power Platform Connections sees David Warner and Hugo Bernier talk to Microsoft MVP Lewis Baybutt aka Low Code Lewis, alongside the latest news and community blogs.   Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show.      Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse.  This episode premiers live on our YouTube at 12pm PST on Thursday 1st June 2023.  Video series available at Power Platform Community YouTube channel.    Upcoming events:  European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas  Join our Communities:  Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community  If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.

#### Microsoft Power Platform Conference | Registration Open | Oct. 3-5 2023

We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida.   Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more.   Register today: https://www.powerplatformconf.com/

#### Check out the new Power Platform Communities Front Door Experience!

We are excited to share the ‘Power Platform Communities Front Door’ experience with you!   Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well.       Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities.     Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform.    Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.