web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Error in searching a c...
Power Apps
Unanswered

Error in searching a collection within a Filter() and If statements for Gallery items

(0) ShareShare
ReportReport
Posted on by

Hi, I have this particular issue that I just can't figure out and would love your possible solutions. The goal is to display the items in a gallery that match the filtered and searched constraints. 

 

Context:

To start it off, the collection is a Parsed JSON file with the string content being converted to text via the Text() function. The two collections, df_coll and df_briefs, are collections with only string values.  The collection look like this:

antonyd_0-1715367225251.png

 

I'm trying to filter out and search the records in the collection and display them in a vertical gallery, using this code in the Gallery items:

 

If(brief_select,
 Filter(
 SortByColumns(
 Search(
 df_briefs,
 search_bar.Text,
 title
 ),
 "release_date",
 SortOrder.Descending
 ),
 release_date >= DatePickerStart.SelectedDate && release_date <= DatePickerEnd.SelectedDate,
 institution_select.SelectedText.Value = "All" Or (institution = institution_select.SelectedText.Value)
 ),
 If(search_title, 
 Filter(
 SortByColumns(
 Search(
 df_coll,
 search_bar.Text,
 title
 ),
 "release_date",
 SortOrder.Descending
 ),
 release_date >= DatePickerStart.SelectedDate && release_date <= DatePickerEnd.SelectedDate,
 file_select.SelectedText.file = "All" Or (file_1 = file_select.SelectedText.file || file_2 = file_select.SelectedText.file),
 ),
//ERROR IS HERE
 Filter(
 SortByColumns(
 Search(
 df_coll,
 search_bar.Text,
 summary
 ),
 "release_date",
 SortOrder.Descending
 ),
 release_date >= DatePickerStart.SelectedDate && release_date <= DatePickerEnd.SelectedDate,
 file_select.SelectedText.file = "All" Or (file_1 = file_select.SelectedText.file || file_2 = file_select.SelectedText.file),
 )
//ERROR IS HERE
 )
)

 

For better understanding:

brief_select: Boolean to separate the df_briefs and df_coll

search_title: Boolean to separate the search operation (between title and summary)

 

The problem:

The separation between df_coll and df_briefs works, and the searchability by title also works, but the moment I attempt to search by summary, I get this error:

antonyd_1-1715370121641.png

with this under the code section of the items code section:

antonyd_2-1715370150834.png

Any help would be appreciative.

Categories:
I have the same question (0)
  • Sunil Kumar Pashikanti Profile Picture
    2,338 Super User 2026 Season 2 on at

    The error you are encountering in Power Apps suggests that there is a mismatch in the expected data type for the 'Text' function. The 'Text' function is expecting a text string, but it seems to be receiving an object instead. This can happen if the data in the 'summary' field of your collection is not purely text-based or if it's structured as a complex object.

     

    Here's a potential solution to address the error:

     

    1. Ensure Data Consistency: Verify that the 'summary' field in your df_coll collection contains only text data. If the 'summary' field is derived from a JSON object, make sure to convert it properly to a text string.

    2. Use the Text Function Correctly: When using the 'Text' function to convert numbers or other data types to text, ensure that the data being passed is compatible with the function. For example:

      Text(Value)

      Replace Value with the actual field or value you're trying to convert.

    3. Debug the Formula: Break down the formula and test each part separately. For instance, try using the 'Search' function on its own with the 'summary' field to see if it returns the expected results.

    4. Check for Delegation Warnings: If your collection is large, you might be running into delegation issues. Power Apps has limits on how many records it can process at once. To resolve delegation errors, consider changing the value from the Power Apps Advanced settings.

  • WarrenBelz Profile Picture
    156,440 Most Valuable Professional on at

    HI @antonyd ,

    I bele3ive that your fundamental issue is possibly that you cannot have alternate data sources in the Items of a Gallery as all potential gallery output needs to be valid whichever is filtered. If the collections are absolutely identical in field names and types, you may have some chance, but I have still encountered this not working with at times strange and misleading errors.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard