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

5 REPLIES 5
JohnP
Level 8

Re: Search function - not equal

Clarified the question a bit - hoping someone have some tips Smiley Happy

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.

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

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 Smiley Happy

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

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 352 members 4,964 guests
Please welcome our newest community members: