cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Data_Enthusiast
Post Patron
Post Patron

Unable to SEARCH in Gallery

Hi Power Apps Community,

I am trying to perform a Search based on the Gallery from a Collection, but have been unsuccessful.

Using the code below, I get the following error: "The specified column "Title1_1" does not exist."

 

Search(Source, TextSearchBox1.Text, "Title1_1")

 

I am not sure if it is based on how the data is stored, but below is the 'Title1_1' that I am wanting to reference for the Search.

Data_Enthusiast_0-1604387999544.png

I would really appreciate any assistance.

Thank you in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi@Data_Enthusiast,

As I mentioned before, the Search() function needs you to directly refer to the column name from the data source. Therefore, referring to the Label name could not help you get there.

Could you please tell me how you set the Text property of the Label? (IMPORTANT!)

How you set the Label decides what to refer to within the Search() function.

Combine that with your description, you use a nested collection as the data source. The column you want to refer to could not exist in a nested collection, it will give you an error message like "The specific column does not exist..." if you refer to the column directly.

I think you should use AddColumns() function to convert the nested column into a normal column.

I have made a similar test, please take a try as below.

Add a Button and set the OnSelect property as below:

 

ClearCollect(nestedCollection,{Title:"Level 1A",Level2:{Title2:"Level 2A"}},{Title:"Level 1B",Level2:{Title2:"Level 2B"}})

 

 

nested.png

Add another Button and set the OnSelect property as below:

 

Collect(temp2,AddColumns(nestedCollection,"Test",Level2.Title2))

 

Note: The temp2 collection will have a normal column where display the nested column item directly.

temp2.png 

Now, you could set the Items property of the Gallery as below:

 

Search(temp2,TextInput3.Text,"Test")

 

Best Regards,

Qi

 

Best Regards,
Qi

View solution in original post

4 REPLIES 4
v-qiaqi-msft
Community Support
Community Support

Hi@Data_Enthusiast,

Based on the issue that you mentioned, do you want to search based on the search bar?

Could you please share a bit more about the search column, is it named "Title1_1" within your data source?

Let me explain the Search() function to you.

Search( Table, SearchString, Column1 [, Column2, ... ] )

  • Table - Required. Table to search.
  • SearchString - Required. The string to search for. If blank or an empty string, all records are returned.
  • Column(s) - Required. The names of columns within Table to search. Columns to search must contain text. Column names must be strings and enclosed in double quotes. 

You could see that the column should be a Text type which is only allowed. So please check:

  1. If the column name is "Title1_1" within your data source
  2. For SharePoint and Excel data sources that contain column names with spaces, specify each space as "_x0020_". For example, specify "Column Name" as "Column_x0020_Name". So check for that if there is any space in your column name.
  3. Check the Text property of the Label within your Gallery, you can directly quote the column name behind the "ThisItem"

I have made a test as below.

In my scenario, I set the Items property of the Gallery as below:

 

SortByColumns(Search(Test1029, TextSearchBox1.Text,"Title"), "Title", If(SortDescending1, Descending, Ascending))

 

Note: Title is my column name from my SP list.

Please go to your data source and check if the column that you want to search for is named "Title1_1".

Best Regards,

Qi

Best Regards,
Qi

Hi @v-qiaqi-msft 

The data is being referenced in a Collection. 

"Title1_1" is the name of the Label.

The actual 'Value' of the record is in one of these:

Data_Enthusiast_0-1604404097885.png

I tried to reference the column name: 'Field.Value' but had no luck with this either.

 

Hi@Data_Enthusiast,

As I mentioned before, the Search() function needs you to directly refer to the column name from the data source. Therefore, referring to the Label name could not help you get there.

Could you please tell me how you set the Text property of the Label? (IMPORTANT!)

How you set the Label decides what to refer to within the Search() function.

Combine that with your description, you use a nested collection as the data source. The column you want to refer to could not exist in a nested collection, it will give you an error message like "The specific column does not exist..." if you refer to the column directly.

I think you should use AddColumns() function to convert the nested column into a normal column.

I have made a similar test, please take a try as below.

Add a Button and set the OnSelect property as below:

 

ClearCollect(nestedCollection,{Title:"Level 1A",Level2:{Title2:"Level 2A"}},{Title:"Level 1B",Level2:{Title2:"Level 2B"}})

 

 

nested.png

Add another Button and set the OnSelect property as below:

 

Collect(temp2,AddColumns(nestedCollection,"Test",Level2.Title2))

 

Note: The temp2 collection will have a normal column where display the nested column item directly.

temp2.png 

Now, you could set the Items property of the Gallery as below:

 

Search(temp2,TextInput3.Text,"Test")

 

Best Regards,

Qi

 

Best Regards,
Qi

Hi @v-qiaqi-msft 

Thank you! This worked for me 🙂

I have picked up quite a strange issue, but I will create a new post for that as this post has been answered. 

Thank you again.

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,120)