cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rmeany
Frequent Visitor

Why doesn't this expression work?

I'm trying to create a collection that contains a list of inventory models belonging to a certain item type when a user selects the item type from a dropdown.  This query returns a zero-sized collection every time though, even though there are definitely items of the type I selected from the dropdown.. 

ClearCollect(
    ModelTypesFilter,
    Filter(
        'Inventory Item Models',
        'Inventory Item Type'.'Type Name' = drpItemType.Selected.'Type Name'
    )
)
1 ACCEPTED SOLUTION

Accepted Solutions
rmeany
Frequent Visitor

I'm giving up on CDS for now.. Just doesn't seem fully implemented yet to me..  

View solution in original post

9 REPLIES 9
mdevaney
Super User III
Super User III

@rmeany 

At least one of the Filter criteria must reference the datasource being filtered 'Inventory Item Models'.  Nothing will show if you try to Filter a datasource according to 'Inventory Item Type'

 

ClearCollect(
    ModelTypesFilter,
    Filter(
        'Inventory Item Models',
        'Inventory Item Type'.'Type Name' = drpItemType.Selected.'Type Name'
    )
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

 

rmeany
Frequent Visitor

Ahh, I thought that the filtered table would be implied in the filter expression if not specified, but I also tried the following and it still does not work:

 

ClearCollect(
    ModelTypesFilter,
    Filter(
        'Inventory Item Models',
        'Inventory Item Models'.'Inventory Item Type'.'Type Name' = drpItemType.Selected.'Type Name'
    )
)

@rmeany 

I am little bit confused now.  I thought 'Inventory Item Type' was a datasource name but now it seems to be a column.  What column type is 'Inventory Item Type'?

rmeany
Frequent Visitor

'Inventory Item Type' is a foreign key reference to the 'Inventory Item Types' table..

 

An item model (example: HP EliteDesk 800) has a type (example: desktop computer) ...  Desktop computer can belong to many different models.

@rmeany 

So is it a Sharepoint LookUp column?

rmeany
Frequent Visitor

No, it's accessing common data services entities.

@rmeany 

Sorry, I am not yet familiar with Common Data Service.

rmeany
Frequent Visitor

When I try to reference the parent table in the collection, the data type of foreign key column is actually a record itself.. I'm guessing it's supposed to be returning the actual record in the parent table...  But referencing it this way seems to be returning a blank record for some reason...

 

First('Inventory Item Models').'Inventory Item Type' = blank even though I know every model in my database has a type associated with it...

rmeany
Frequent Visitor

I'm giving up on CDS for now.. Just doesn't seem fully implemented yet to me..  

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,203)