cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jagostinho_CT
Advocate I
Advocate I

Search function throws error

I was following the steps in this video while trying to create a SearchBox to look for an input in two fields "ProjectID" and "Project Name" but I am getting an error that I cannot figure out what it means.

 

Also, the Source is a Sharepoint List with only 161 items and both of the fields to be searched are set to be "Single Line of Text".

 

Thank you in advance for your help.

jagostinho_CT_0-1602253299923.png

 

10 REPLIES 10
timl
Super User III
Super User III

Hi @jagostinho_CT 

Looking at your screenshot, you appear to have named your search text box Search.

This name would conflict with the Search function. If you rename the text box to something like txtSearch, that should solve the problem.

RandyHayes
Super User III
Super User III

@jagostinho_CT 

Your ProjectID is most likely a numeric column, not a text column.

 

Search only works on text columns.

You can work around this with the following change to your formula:

Search(
    AddColumns(ProjectsInfoDB, "projectIDtxt", Text(ProjectID)), 
    Search.Text, 
    "projectIDtxt", "ProjectName"
)

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@jagostinho_CT 

And what @timl mentioned also...

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thank you for the quick replies.

 

The "ProjectID" field type is Text as all the ProjectIDs contain a mix of numbers and letters such as A123ABC or 999NNN

 

The code below is still producing a similar error.

Search(AddColumns(ProjectsInfoDB,"ProjectIDtxt",Text("ProjectID")),txtSearch_1.Text,"ProjectIDtxt","ProjectName")

jagostinho_CT_0-1602255991712.png

 

And rather than a Yellow sign warning is not displaying a Red sign one. 😞

 

jagostinho_CT_1-1602256085173.pngjagostinho_CT_2-1602256104958.png

 

 

@jagostinho_CT 

So if the columns you are searching are all text, then you need not adjust the formula to add the column as I suggested.

The core reason was as @timl mentioned with the naming.

Your formula should be the following:

Search(ProjectsInfoDB,  
       txtSearch_1.Text,
       "ProjectIDtxt","ProjectName"
)

 

You are putting this formula in the Items property of your Gallery...correct?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hi @jagostinho_CT 

Just to confirm, if you don't call AddColumns, do you still receive the same error?

Search(ProjectsInfoDB,
       txtSearch_1.Text,
       "ProjectID"
       "ProjectName"
)

 

Not same, different.

I am thinking because I then need to include "ProjectsInfoDB"?

Search(ProjectsInfoDB,txtSearch_1.Text,"ProjectID","ProjectName")

Which is still throwing an error, though a yellow sign error. The suggested fixes are

1. decrease the number of items. but these are already below 500 items

2. simplify the formula. how to do it? It looks to me that the formula is already very basic

3. Change data source location. I would really like to keep it where it is. Is this really the reason why it is breaking?

 

jagostinho_CT_1-1602257437763.png

 

 

jagostinho_CT_0-1602257350423.png

 

Not sure what you mean by

You are putting this formula in the Items property of your Gallery...correct?

 I am typing in in the Text Input box.

@jagostinho_CT 

What @RandyHayes is asking is - are you entering this formula into the Items property of your gallery control?

 

timl_0-1602257921508.png

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

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

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (854)