cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anthony_Bellai
Frequent Visitor

Need help configuring search bar for integer

Hello. I am trying to configure a search bar that searches for a student ID number. I realize powerapps works well with strings and is a bit difficult with integers. If someone could help me out that would be great. I cannot give out the db name so for the sake of any example please just use 'database' and for the table simply use 'table'. The column name is StudentID. 

1 ACCEPTED SOLUTION

Accepted Solutions

@Anthony_Bellai  ok, you can try this: 

 

Filter('[dbo].[SOURCE]',Value(StudentID)=Value(TextSearchBox1.Text)

 

You might cause some delegation issues though.. 

 

If you share your error messge by hovering over the red underline in your formula I will see if there is a better solution. 

 

Thanks, 

Luke

View solution in original post

5 REPLIES 5
leyburn19
Memorable Member
Memorable Member

Say search bar is named textinput1.text

 

In your gallery filter simple put:

 

Filter(Source,ID=value(Textinput1.Text)

 

I do this a lot but with more complexity in that I may also want Surname or First Name in the serach bar so I use

 

If(IsNumber(Textinput1.Text,Filter(Source,ID=value(Textinput1.Text),Filter(Source,Startswith(Surname,TextInput1.Text)||Startswith(FirstName,TextInput1.Text)))

 

@leyburn19 it looks like he is already doing that in his screenshot.

 

@Anthony_Bellai  what is the data type of your studentid SQL Column?  you might be comparing data with different types. 

 

Thanks, 

Luke

@Luke_Timmins 

 

The student IDs are integers. 

 

Filter('[dbo].[SOURCE]',StudentID=Value(TextSearchBox1.Text)

 

The values being compared aren't the same type.

@Anthony_Bellai  ok, you can try this: 

 

Filter('[dbo].[SOURCE]',Value(StudentID)=Value(TextSearchBox1.Text)

 

You might cause some delegation issues though.. 

 

If you share your error messge by hovering over the red underline in your formula I will see if there is a better solution. 

 

Thanks, 

Luke

This worked, or will work, unfortunately my dataset is much larger than 2000 rows but the formula is correct and will help me in the long run. Thank you very much, @Luke_Timmins !

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,488)