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

@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
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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