cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JDG-VES
New Member

If statement in items property expects a record but returns a table, I need a table for the items list.

Hi can't seem to find a solution to this one.

I have two statements that work independently in the items property of a dropdown menu. 

When I connect the two statement using an If function, I get an error on the filter half of the if statement saying a table was returned when it expected a record. 

I want the returned table from the filter function to be my items in the items property of the drop down menu. 

Here is the code that is giving me the issue.

If(
ItemClick="true",

LookUp(ItemData,Item=Dropdown2.SelectedText.Item), // This line works

Filter(ItemData,Location=Dropdown2_1.Selected.Locations)) // This works by itself but not inside this if statement.

 

All help is appreciated.

 

1 ACCEPTED SOLUTION

Accepted Solutions
shoog
Dual Super User
Dual Super User

LookUp returns a single record while Filter returns a table, so that's why you can't combine the two. The If statement should return the same datatype for the true and false parts.

 

You can change the LookUp to a Filter to solve this:

If(ItemClick="true",
   Filter(ItemData,Item=Dropdown2.SelectedText.Item),
   Filter(ItemData,Location=Dropdown2_1.Selected.Locations)
)

View solution in original post

2 REPLIES 2
shoog
Dual Super User
Dual Super User

LookUp returns a single record while Filter returns a table, so that's why you can't combine the two. The If statement should return the same datatype for the true and false parts.

 

You can change the LookUp to a Filter to solve this:

If(ItemClick="true",
   Filter(ItemData,Item=Dropdown2.SelectedText.Item),
   Filter(ItemData,Location=Dropdown2_1.Selected.Locations)
)

Thanks so much, learn something new everyday. Good to know the data type for both halves of the if statement have to be the same.

 

Thanks!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (2,574)