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
aganietaqeef
Level: Powered On

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

aganietaqeef
Level: Powered On

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 @aganietaqeef

 

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
aganietaqeef
Level: Powered On

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 @aganietaqeef

 

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!