cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JohnP
Level 8

Search function - not equal

Maybe I'm missing something obvious, but I have the following code that works well on a gallery items:

 

Filter(Projects; OrganizationLookup.Value in Search(Organization; UserCurrent; "DisplayName").Title)

This returns projects belonging to one or more organizational units (where UserCurrent is the owner).

 

I would like to negate this function so that it returns projects that does not belong to these organizational units. How to do this? Not In or negating the whole function does not work.

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: Search function - not equal

Hi @JohnP

 

Hmm maybe we should try negating the whole thing, perhaps something like this:

 

Filter(Projects; Not(OrganizationLookup.Value in (Search(Organization; UserCurrent; "DisplayName").Title)))

Move the Not to the beginning of the function to see if that helps.. 

View solution in original post

5 REPLIES 5
JohnP
Level 8

Re: Search function - not equal

Clarified the question a bit - hoping someone have some tips 🙂

Anonymous
Not applicable

Re: Search function - not equal

Hi @JohnP

 

I could be wrong but you could try using the Not function:

 

Filter(Projects; OrganizationLookup.Value in Not(Search(Organization; UserCurrent; "DisplayName").Title))

 When using the Not function it makes whatever you want within the brackets the opposite.

 

The Not function returns true if its argument is false; it returns false if its argument is true. The !operator is equivalent to Not.

JohnP
Level 8

Re: Search function - not equal

Hi @Anonymous

 

I tried that before and it did not work - "The function 'Not' has some invalid arguments."

The Not function cannot reverse the return values from the Search function (which is a set of records). The logic is inside the Search function. I think maybe I have to rethink how I filter/display the projects.

Anonymous
Not applicable

Re: Search function - not equal

Hi @JohnP

 

Hmm maybe we should try negating the whole thing, perhaps something like this:

 

Filter(Projects; Not(OrganizationLookup.Value in (Search(Organization; UserCurrent; "DisplayName").Title)))

Move the Not to the beginning of the function to see if that helps.. 

View solution in original post

Highlighted
JohnP
Level 8

Re: Search function - not equal

Hi @Anonymous

 

Haha ... I came to the exact same conclusion when you replied with the same solution 🙂

Some times two heads think better than one - thanks again!

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (6,038)