cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HansHeintz
Helper V
Helper V

Conflicting results from same filter

I filter a collection (cached table) like this

 

;;ClearCollect(ZoekDieren;Filter(ZoekDieren2;!IsBlank((LookUp(CachedAsielVerblijf;dier_id=dier_id)))))

The resulting gallery showing zoekdieren shows lots of records.

I put a label in the items of the gallery

 

IsBlank(LookUp(CachedAsielVerblijf;dier_id=ThisItem.dier_id))

The label says true for some items, false for others.

I find this strange since the filter should have discarded all items that do not exist in CachedAsielVerblijf in the first place.

If I try to solve this bu disambiguating the first code

;;ClearCollect(ZoekDieren;Filter(ZoekDieren2;!IsBlank((LookUp(CachedAsielVerblijf;CachedAsielVerblijf.dier_id=ZoekDieren2.dier_id)))))

I get red curlies under the = as if I am not comparing two integers. dier_id is never ever anywhere in my code or any table anything else then an integer.

 

What is the matter here?

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Well i solved it like this

 

    ;UpdateContext({FilteredAsielVerblijf:SortByColumns('[dbo].[asiel_verblijf]'; "vertrek_datum"; SortOrder.Ascending)})
        ;;UpdateContext({FilteredAsielVerblijf:Filter(FilteredAsielVerblijf;Day(vertrek_datum)=0)})
        ;;Clear(LookUpTable)
        ;;ForAll(FilteredAsielVerblijf;Collect(LookUpTable;{lookupdierid:dier_id}))
        ;;ClearCollect(ZoekDieren3;AddColumns(ZoekDieren2;"disambigudierid";dier_id))
        ;;ClearCollect(ZoekDieren;Filter(ZoekDieren3;!IsBlank(LookUp(LookUpTable;disambigudierid=lookupdierid))))

Mus be about the ugliest code I ever wrote lol!

View solution in original post

4 REPLIES 4
Jeff_Thorpe
Super User
Super User

Have you tried using IsEmpty instead of IsBlank?

 

;;ClearCollect(ZoekDieren;Filter(ZoekDieren2;!IsEmpty((LookUp(CachedAsielVerblijf;dier_id=dier_id)))))



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Same difference.

Empty refers to none in a set of records (countrows=0), Blank refers to (in this case) one record that is not there.

Documentation on lookup:

 

The LookUp function finds the first record

 

LookUp( IceCream, Flavor = "Pistachio", OnOrder )Searches for a record with Flavor equal to "Pistachio", of which there are none. Because none were found, Lookup returns blank.blank

If I try to replace the !IsBlank(LookUp.. with a CountRows(Filter..>0 construction it does a countrows on all (my delegation maximum.

It seems I need to disambiguate my statement but how?

Well i solved it like this

 

    ;UpdateContext({FilteredAsielVerblijf:SortByColumns('[dbo].[asiel_verblijf]'; "vertrek_datum"; SortOrder.Ascending)})
        ;;UpdateContext({FilteredAsielVerblijf:Filter(FilteredAsielVerblijf;Day(vertrek_datum)=0)})
        ;;Clear(LookUpTable)
        ;;ForAll(FilteredAsielVerblijf;Collect(LookUpTable;{lookupdierid:dier_id}))
        ;;ClearCollect(ZoekDieren3;AddColumns(ZoekDieren2;"disambigudierid";dier_id))
        ;;ClearCollect(ZoekDieren;Filter(ZoekDieren3;!IsBlank(LookUp(LookUpTable;disambigudierid=lookupdierid))))

Mus be about the ugliest code I ever wrote lol!

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (58,974)