cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Crimbo
New Member

DataCard Validation for a number entry

I am trying to validate data entries into SQL Server through a form.  I have the following validation against a number entry for an icon next to the DataCardValue:

 

If(
IsMatch(
DataCardValue29.Text,
Digit
),
Check,
Icon.Warning
)

 

This works if the entry is a single digit as given below:

Screenshot 2020-06-25 at 23.27.11.png

 

However when the entry has more than 1 digit, it will not work as shown below:

 

Screenshot 2020-06-25 at 23.27.26.png

 

 

How can i make it work for number with one or more digits?

 

Best regards,

Chris

1 ACCEPTED SOLUTION

Accepted Solutions

@Crimbo 

Well, I guess the issue is just whether the user input ANY value since we know it must be a number.


Put this code in the Icon property of your Icon.

 

If(IsBlank(TextInput_Field.Text), Icon.Check, Icon.Warning)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

4 REPLIES 4
mdevaney
Super User
Super User

@Crimbo 

Don’t bother with Regex.  Just change the Format property of the Text Input to this code and it will only allow number entries

 

Format.Number

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Many thanks for your response, most appreciated.

 

The format property is already in number format, so yes right now it is only accepting number formats.  However, it would be best practice to alert the user that the entry is acceptable through the icon next to the input.

 

Regards,

Chris

@Crimbo 

Well, I guess the issue is just whether the user input ANY value since we know it must be a number.


Put this code in the Icon property of your Icon.

 

If(IsBlank(TextInput_Field.Text), Icon.Check, Icon.Warning)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Many thanks for the solution.  I had to re-arrange the order of the icons as follows:

 

If(
IsBlank(DataCardValue29.Text),
Icon.Warning, Icon.Check
)

 

Best regards,

Chris

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (1,754)