cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User III
Super User III

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

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

Community Support
Community Support

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.

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.

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.

Community Support
Community Support

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.

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (98,925)