cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Tezz233
Helper II
Helper II

Check if textbox is number

ID_Code = TextInput1.Text

 

If I enter a string such as "ABC" into TextInput1, the above code will tell me if he user input (ABC) exists in the database's ID_Code column. Is there a way to get this to work with numbers? For example, if I type 123 into TextInput1, the code should check that specific input to see if it exists in the database. I had a look into casting, but couldn't get anything to work.

2 ACCEPTED SOLUTIONS

Accepted Solutions
bean
Continued Contributor
Continued Contributor

To cast the textbox value to a number simply use this

 

Number(TextInput1.Text)

Good luck

Sean

View solution in original post

CarlosFigueira
Power Apps
Power Apps

As @bean suggested, if you need to compare the value of a text box to a numeric column in your data source, you should convert it to a number first - using the Value function. For example, you can have a gallery with this expression for its Items property:

Filter(MyDataSource, ID_Code = Value(TextInput1.Text))

View solution in original post

4 REPLIES 4
bean
Continued Contributor
Continued Contributor

Does this help?

 

If(IsNumeric(TextInput1.Text), "Number", "Alphanumeric")

Sean

bean
Continued Contributor
Continued Contributor

If you could provide more detail on what you're trying to do that will help more.

 

Cheers

bean
Continued Contributor
Continued Contributor

To cast the textbox value to a number simply use this

 

Number(TextInput1.Text)

Good luck

Sean

View solution in original post

CarlosFigueira
Power Apps
Power Apps

As @bean suggested, if you need to compare the value of a text box to a numeric column in your data source, you should convert it to a number first - using the Value function. For example, you can have a gallery with this expression for its Items property:

Filter(MyDataSource, ID_Code = Value(TextInput1.Text))

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,297)