cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Search: Invalid argument type (Table). Expecting a Boolean value instead

Need help. Formula works well until I enter the IF function to display all records when default is selected on dropdown. I can't figure out how to fix this. I'm trying to add the IF function so that I can use the search bar independently without selecting the dropdown menu

Screen Shot 2020-07-23 at 4.27.29 AM.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Search: Invalid argument type (Table). Expecting a Boolean value instead

Hi @imejias ,

Did some testing - Search does not seem to like If statements inside - this should work

If(
   Dropdown1.Selected.ResuIt="Division Search",
   Search(
      Directory,
      TextSearchBoxl.Text,
      "Title",
      "Division",
      "Process",
      "JobTitle"
   ),
   Search(
      Filter(
         Directory,
         Division=Dropdown1.Selected.Result
      ),
      TextSearchBoxl.Text,
      "Title",
      "Division",
      "Process",
      "JobTitle"
   )
)

 

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.

 

View solution in original post

6 REPLIES 6
Highlighted
Super User III
Super User III

Re: Search: Invalid argument type (Table). Expecting a Boolean value instead

Hi @imejias ,

Did some testing - Search does not seem to like If statements inside - this should work

If(
   Dropdown1.Selected.ResuIt="Division Search",
   Search(
      Directory,
      TextSearchBoxl.Text,
      "Title",
      "Division",
      "Process",
      "JobTitle"
   ),
   Search(
      Filter(
         Directory,
         Division=Dropdown1.Selected.Result
      ),
      TextSearchBoxl.Text,
      "Title",
      "Division",
      "Process",
      "JobTitle"
   )
)

 

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.

 

View solution in original post

Highlighted
Community Support
Community Support

Re: Search: Invalid argument type (Table). Expecting a Boolean value instead

Hi @imejias ,

Could you please share a bit more about the 'Directory' data source? Is it a SP List?

Could you please show more details about the "Process" column and "Dept" column? Are they single text type column or Choice type column?

 

According to the screenshot that you mentioned, I think your whole Filter formula is in right direction. The issue seems to be related to the "Process" column and "Dept" column in your Search function. I guess they are both Choice type column rather than single text type column, right?

 

The important thing you need to know is that, within the Search function in canvas app, you could only use Text type column as Search column, the complex type column (e.g. Choice type column , LookUp type column, Person type column...) could not be used as Search column in the Search function.

 

I assume that your data source is a SP list, and the "Process" column and "Dept" column are both Choice type column, you need to modify your formula as below:

Filter(
       Directory,
       If(
          Dropdown1.Selected.Result = "Division Search",
          true,
          Division = Dropdown1.Selected.Result
       ),
       If(
           IsBlank(TextSearchBox1.Text),
           true,
           TextSearchBox1.Text in Title || TextSearchBox1.Text in Division || TextSearchBox1.Text in Process.Value || TextSearchBox1.Text in JobTitle || TextSearchBox1.Text in Dept.Value
       )
)

Please try above formula, then check if could help in your scenario.

 

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.
Highlighted
Super User III
Super User III

Re: Search: Invalid argument type (Table). Expecting a Boolean value instead

Yes @v-xida-msft , that will work as well, but I was trying to keep the same functionality.

@imejias , please confirm if my direction is what you are asking - I have tested the syntax and it works.

Highlighted
Super User III
Super User III

Re: Search: Invalid argument type (Table). Expecting a Boolean value instead

Hi @imejias ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Highlighted
Community Support
Community Support

Re: Search: Invalid argument type (Table). Expecting a Boolean value instead

Hi @imejias ,

Have you taken a try with the solution I provided above? Have you solved your problem?

 

If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

 

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.
Highlighted
New Member

Re: Search: Invalid argument type (Table). Expecting a Boolean value instead

Thanks for your help @WarrenBelz  and @v-xida-msft. Yes, the Directory data source is from a custom list on sharepoint.

Silly for me, i just completely forgot to close the IF argument with a ")" and it works fine now but i will try using your solutions on other directories i'm working on.

 

IF Argument.JPG

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,877)