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 / Search function error.
Power Apps
Answered

Search function error.

(0) ShareShare
ReportReport
Posted on by 43
Hi All,
my PowerApps is connected to my SharePoint List with over 10000 records and growing.  I added a search function using a flow automate to search through the whole SharePoint list.
The Search function works fine. It searches any text input without delegation issues thanks to the flow automate (SearchData.Run).
 
Next step is for the App to load all gallery items when the app loads. 
At the App.OnStart ,  I added this code.     "ClearCollect(colAssetsearch,ShowColumns('Assets',Barcode,Category_Class,Asset_type,Department,Location,Status,Condition))"
 
and get an error immediately on both this code and the button code.
 
the error is "invalid argument type"  on the collection name colAssetsearch .
 
i noticed the issue comes from my choice columns. When i remove my choice columns from the OnStart function and leave the text columns, all the errors disappear. I have tried different iterations of adding choice columns, but the same error persists. Department,Location,Status,Condition are my choice columns.
 

I request help figuring out to load all gallery items at app startup and if you think the flow automate has an effect on the errors, I will gladly share the flow as well.
 
 
Button.OnSelect  code: 
ClearCollect(colAssetsearch,ForAll(Table(ParseJSON(SearchData.Run(TextInput3.Text).searchresult)),{Barcode:Text(Value.Barcode),Category_Class:Text(Value.Category_Class),Asset_type:Text(Value.Asset_type),Location:Text(Value.Location),Department:Text(Value.Department),Status:Text(Value.Status),Condition:Text(Value.Condition)}))
 
Gallery.ItemscolAssetsearch
 
App.OnStart  code: 
ClearCollect(colAssetsearch,ShowColumns('Assets',Barcode,Category_Class,Asset_type,Department,Location,Status,Condition))
 
 
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    156,117 Most Valuable Professional on at
    You seem to have the same collection generated in two places with potentially different field types - on the Button
    ClearCollect(
       colAssetsearch,
       ForAll(
          Table(
             ParseJSON(
                SearchData.Run(
                   TextInput3.Text
                ).searchresult
             )
          ),
          {
             Barcode: Text(Value.Barcode),
             Category_Class: Text(Value.Category_Class),
             Asset_type: Text(Value.Asset_type),
             Location: Text(Value.Location),
             Department: Text(Value.Department),
             Status: Text(Value.Status),
             Condition: Text(Value.Condition)
          }
       )
    )
    I would suspect those fields are being returned as Text whereas OnStart
    ClearCollect(
       colAssetsearch,
       ShowColumns(
          'Assets',
          Barcode,
          Category_Class,
          Asset_type,
          Department,
          Location,
          Status,
          Condition
       )
    )
    (as you have noted) some are Choice and therefore are Table fields.
    So Power Apps is telling you that you cannot have the same fields in the same Collection with two different data types.
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • frank90 Profile Picture
    43 on at
    How do i phrase the choice columns in my OnStart or the Button to match? 
  • Verified answer
    WarrenBelz Profile Picture
    156,117 Most Valuable Professional on at
    Very messy, but it would be far easier to simply make them all Text in your data source and hard-code the choices in Power Apps. If you did this, your original posted code would work.
    With(
       {
          _Data: 
          ShowColumns(
             AddColumns(
                'Assets,
                DeptVal,
                Department.Value,
                LocVal,
                Location.Value,
                StatVal,
                Status.Value,
                ConVal,
                Condition.Value
             ),
             Barcode,
             Category_Class,
             Asset_type
             DeptVal,
             LocVal,
             StatVal,
             ConVal
          )
       },
       ClearCollect(
          colAssetSearch,
          RenameColumns(
             _Data,
             DeptVal,
             Department,
             LocVal,
             Location,
             StatVal,
             Status,
             ConVal,
             Condition
          )
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • WarrenBelz Profile Picture
    156,117 Most Valuable Professional on at
    A quick follow-up to see if you received the answer you were looking for or if you need further assistance.

    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn   
  • frank90 Profile Picture
    43 on at
    when I convert the SharePoint Choice columns into text columns, your solution works.
    Thanks once again @WarrenBelz
     

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 326 Most Valuable Professional

#2
11manish Profile Picture

11manish 168

#3
sannavajjala87 Profile Picture

sannavajjala87 75 Super User 2026 Season 1

Last 30 days Overall leaderboard