# find()

**URL:** <https://forum.servoy.com/t/find/17572>\
**Category:** Classic Servoy\
**Created:** [October 24, 2013, 12:43pm UTC](https://forum.servoy.com/t/find/17572 "2013-10-24T12:43:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jos\_devoon.nl](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@jos\_devoon.nl](https://forum.servoy.com/u/jos_devoon.nl)\
**Post date:** [October 24, 2013, 12:43pm UTC](https://forum.servoy.com/t/find/17572/1 "2013-10-24T12:43:59Z")

</div>

when you work with foundsets you often deal with find().  
According to the documentation one can use an array of values to use the ‘IN’ statement.  
Like:  
foundset.user\_id = [222,534,464]  
works fine.

The opposite, i.e. ‘NOT IN’ is not possible, or I can’t find the right syntax for it?

foundset.user\_id = ![545,687,876] → does not work

So I use a query → loadrecords(query) instead. Or is there another way?

---

<div class="post-metadata">

**Author:** ![sovanm](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@sovanm](https://forum.servoy.com/u/sovanm)\
**Post date:** [October 24, 2013, 1:13pm UTC](https://forum.servoy.com/t/find/17572/2 "2013-10-24T13:13:26Z")

</div>

Hi Jos,

I was in the same confusion few days back, on which i had two options to achieve. I am sharing those below. I used the second one because first one might take a bit more time as it had to do a search and then invert the foundset.

You can do this to achieve the result

```auto
if(foundset.find()) {

     foundset.user_id = [545,687,876];
     foundset.search();
     foundset.invertRecords();
}

```

Or you can use the query object as

```auto
      // Create the query
		/**@type {QBSelect<db:/server/users>}*/
		var QBSelectObj = databaseManager.createSelect('db:/server/users');
		
		// Build the filtration statement
		QBSelectObj.where
			.add(QBSelectObj
				.not(QBSelectObj.columns.user_id.isin([545,687,876])));
		
		// Load the foundset
		foundset.loadRecords(QBSelectObj);

```

I am also not sure if these is the best way or not. If some better ways are available please do share.

---

<div class="post-metadata">

**Author:** ![jos\_devoon.nl](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@jos\_devoon.nl](https://forum.servoy.com/u/jos_devoon.nl)\
**Post date:** [October 24, 2013, 1:49pm UTC](https://forum.servoy.com/t/find/17572/3 "2013-10-24T13:49:52Z")

</div>

Hi Sovan,

I did not think about the first option. but it might work, but when there are more then one search criteria it gets complicated (-:

I use indeed the second one like you (with query’s)
