cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gaurav01
Regular Visitor

Filter with Search together

Hi, 

 

I am trying to put search in on of the gallery. However, there's already a filter function on it. How can I put both the functions together. 

 

My Current function is: Filter('sqlservetable' , XYZ=123) 

 

But I also need to put search so that users can find specific numbers while app is retrieving certain fields through a table. 

 

I tried to put:

 

Search(Filter('sqlservertable' , XYZ=123), searchbox_1.Text, XYZ)

 

But it is not working. It would be helpful if you could please let me know how does that work. I am new to PowerApp. Any help is  much appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Filter with Search together

Hi @Gaurav01 ,

Could you please share a bit more about the "XYZ" column in your data source? Is it a Number type column?

 

Based on the formula you provided, I think there is something wrong with it. In addition, I think the Value(searchbox_1.Text) could not also fix your issue.

The second argument of the Search function is required to provide a Text value rather than a number value. The third argument of the Search function is required to provided a Text type column (should be wrapped with double quotes "" ).

 

As an alternative solution, I think the AddColumns function could achieve your needs. Please consider modify your formula as below:

Search(
       AddColumns(Filter('sqlservertable' , XYZ=123), "TextXYZ", Text(XYZ)),
       searchbox_1.Text, 
       "TextXYZ"
)

Note: Please consider set the "Data row limit for Non-delegable queries" option to maximum value -- 2000 within Advanced settings of App settings of your app.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Filter with Search together

@Gaurav01 

Your code looks fine except one minor detail.  You will need to convert your Searchbox text into a Value so it matches the data type of the number you are looking for.  I had a similar issue when I was beginning PowerApps.

 

Search(Filter('sqlservertable' , XYZ=123), Value(searchbox_1.Text), XYZ)

 

---
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."

dynamicsedge Power Participant
Power Participant

Re: Filter with Search together

@Gaurav01 

 

Presuming your data type is supposed to be a number, you should use something like Value(searchbox_1.Text)

 

This could be one possible reason why it was not working.

Gaurav01
Regular Visitor

Re: Filter with Search together

Thank you so much! But why value?

Super User
Super User

Re: Filter with Search together

@Gaurav01 

Value converts a Text string into a number data type.  You must compare a number data type to another number data type.

 

---
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."

dynamicsedge Power Participant
Power Participant

Re: Filter with Search together

@Gaurav01

 

Because that PowerApps function converts Text to an actual Number value, which is what your app might be expecting in this case because the data type is Number, but the entered search box text is of type Text which needs to be converted to Number.

 

 

"The Value function converts a string of text that contains number characters to a number value. Use this function when you need to perform calculations on numbers that were entered as text by a user."

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-value

 

 

Community Support
Community Support

Re: Filter with Search together

Hi @Gaurav01 ,

Could you please share a bit more about the "XYZ" column in your data source? Is it a Number type column?

 

Based on the formula you provided, I think there is something wrong with it. In addition, I think the Value(searchbox_1.Text) could not also fix your issue.

The second argument of the Search function is required to provide a Text value rather than a number value. The third argument of the Search function is required to provided a Text type column (should be wrapped with double quotes "" ).

 

As an alternative solution, I think the AddColumns function could achieve your needs. Please consider modify your formula as below:

Search(
       AddColumns(Filter('sqlservertable' , XYZ=123), "TextXYZ", Text(XYZ)),
       searchbox_1.Text, 
       "TextXYZ"
)

Note: Please consider set the "Data row limit for Non-delegable queries" option to maximum value -- 2000 within Advanced settings of App settings of your app.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

Top Solution Authors
Top Kudoed Authors
Users online (7,676)