cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Frequent Visitor

Re: Why doesn't this expression work?

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

Re: Why doesn't this expression work?

@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."

 

Highlighted
Frequent Visitor

Re: Why doesn't this expression work?

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'
    )
)
Highlighted
Super User
Super User

Re: Why doesn't this expression work?

@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'?

Highlighted
Frequent Visitor

Re: Why doesn't this expression work?

'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.

Highlighted
Super User
Super User

Re: Why doesn't this expression work?

@rmeany 

So is it a Sharepoint LookUp column?

Highlighted
Frequent Visitor

Re: Why doesn't this expression work?

No, it's accessing common data services entities.

Highlighted
Super User
Super User

Re: Why doesn't this expression work?

@rmeany 

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

Highlighted
Frequent Visitor

Re: Why doesn't this expression work?

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...

Highlighted
Frequent Visitor

Re: Why doesn't this expression work?

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (10,440)