# Find() filter = undefined?

**URL:** <https://forum.servoy.com/t/find-filter-undefined/11224>\
**Category:** Classic Servoy\
**Created:** [September 30, 2009, 2:28pm UTC](https://forum.servoy.com/t/find-filter-undefined/11224 "2009-09-30T14:28:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Foobrother](https://avatars.discourse-cdn.com/v4/letter/f/50afbb/32.png) [@Foobrother](https://forum.servoy.com/u/Foobrother)\
**Post date:** [September 30, 2009, 2:28pm UTC](https://forum.servoy.com/t/find-filter-undefined/11224/1 "2009-09-30T14:28:27Z")

</div>

Hi everybody,

I’m doing a method which makes a search depending on what the user entered in the fields. To make it easy to explain let assume that there are 4types of records: A, B, C and D

The search works except that it seems to seach on the records of type A and B and never give results with records of type C and D as if there was a constant filter to search only for A and B records.  
Even when you don’t enter anything in the filter fields (in that case it should display all the records) it still return only records of type A and B

So, in order to find the problem I have printed the content of the filter fields just before the controller.search() (no parameter so the search should search in all data in the table). Example: ```  
application.output("forms.frm\_expenses\_list.fld\_approved\_by = "+forms.frm\_expenses\_list.fld\_approved\_by);

```auto

Results printed look ok: nothing printed. Except for few fields which print "undefined". Example:

```

forms.frm\_expenses\_list.fld\_submitted =  
forms.frm\_expenses\_list.fld\_approved\_by = undefined

```auto

It doesn't seems to influence the search as records of type A and B are displayed.

There are only 2 fields which, once filtered, could provide the type of result I have at the moment. The 1st one prints nothing and the second one prints "undefined".

Also, to make sure it is this search which is not working properly I do a "controller.getMaxRecordIndex()" which confirms that the search doesn't provide the right number of results.
```

---

<div class="post-metadata">

**Author:** ![ROCLASI](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/roclasi/32/4371_2.png) [@ROCLASI](https://forum.servoy.com/u/ROCLASI)\
**Post date:** [September 30, 2009, 3:32pm UTC](https://forum.servoy.com/t/find-filter-undefined/11224/2 "2009-09-30T15:32:08Z")

</div>

Hi,

What if you don’t use the empty (and undefined) values in your search? Did you try that yet?

---

<div class="post-metadata">

**Author:** ![Foobrother](https://avatars.discourse-cdn.com/v4/letter/f/50afbb/32.png) [@Foobrother](https://forum.servoy.com/u/Foobrother)\
**Post date:** [October 1, 2009, 10:35am UTC](https://forum.servoy.com/t/find-filter-undefined/11224/3 "2009-10-01T10:35:53Z")

</div>

> ROCLASI:  
> What if you don’t use the empty (and undefined) values in your search? Did you try that yet?

Was a good idea!

I’ve hardcoded the filter with a fix value and then printed it and still print “undefined” ![:shock:]( "Shocked")

```auto
forms.frm_expenses_list.fld_approved_by = 57;
application.output("forms.frm_expenses_list.fld_approved_by = "+forms.frm_expenses_list.fld_approved_by);

```

> forms.frm\_expenses\_list.fld\_approved\_by = undefined

---

<div class="post-metadata">

**Author:** ![Foobrother](https://avatars.discourse-cdn.com/v4/letter/f/50afbb/32.png) [@Foobrother](https://forum.servoy.com/u/Foobrother)\
**Post date:** [October 1, 2009, 10:44am UTC](https://forum.servoy.com/t/find-filter-undefined/11224/4 "2009-10-01T10:44:28Z")

</div>

![:oops:]( "Embarassed")

Ok, forget this story with “undefined”. It was just because the fields name didn’t correspond to the table fields name ![:oops:]( "Embarassed")  
Now all filters are totaly empty.

But I still have this issue with only records of type A and B displayed ![:|]( "Neutral")

---

<div class="post-metadata">

**Author:** ![Foobrother](https://avatars.discourse-cdn.com/v4/letter/f/50afbb/32.png) [@Foobrother](https://forum.servoy.com/u/Foobrother)\
**Post date:** [October 5, 2009, 1:47pm UTC](https://forum.servoy.com/t/find-filter-undefined/11224/5 "2009-10-05T13:47:54Z")

</div>

I really don’t understand. It displays that all the filters are at null but It still display half of the reords ![:(]( "Sad")  
Here is the code I use:

```auto
if (forms[v_list].controller.find())
		{
			globals.SetFilters(v_form);
			try{
				forms[v_list].controller.search();
				application.output("FilterList() Max Records = "+forms[v_list].controller.getMaxRecordIndex());
			}
			catch (e){}
			....
		}

```

At the end of SetFilters I print the content of all the fields of the table attached to the form.  
As you can see there is no code between the print and the when I display the number of results.

Any suggestion?
