Find() filter = undefined?

Questions, tips and tricks and techniques for scripting in Servoy

Find() filter = undefined?

Postby Foobrother » Wed Sep 30, 2009 4:28 pm

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:
Code: Select all
application.output("forms.frm_expenses_list.fld_approved_by = "+forms.frm_expenses_list.fld_approved_by);


Results printed look ok: nothing printed. Except for few fields which print "undefined". Example:
Code: Select all
forms.frm_expenses_list.fld_submitted =
forms.frm_expenses_list.fld_approved_by = undefined

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.
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: Find() filter = undefined?

Postby ROCLASI » Wed Sep 30, 2009 5:32 pm

Hi,

What if you don't use the empty (and undefined) values in your search? Did you try that yet?
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Find() filter = undefined?

Postby Foobrother » Thu Oct 01, 2009 12:35 pm

ROCLASI wrote: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:
Code: Select all
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
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: Find() filter = undefined?

Postby Foobrother » Thu Oct 01, 2009 12:44 pm

:oops:

Ok, forget this story with "undefined". It was just because the fields name didn't correspond to the table fields name :oops:
Now all filters are totaly empty.

But I still have this issue with only records of type A and B displayed :|
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm

Re: Find() filter = undefined?

Postby Foobrother » Mon Oct 05, 2009 3:47 pm

I really don't understand. It displays that all the filters are at null but It still display half of the reords :(
Here is the code I use:
Code: Select all
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?
Current configuration: Servoy 5.2.6 Build 1011, Java 6u24, PostgreSQL 8.3, Windows Server 2003

Servoy / Java Developer
http://www.assetguardian.com
User avatar
Foobrother
 
Posts: 530
Joined: Tue Jan 13, 2009 5:46 pm


Return to Methods

Who is online

Users browsing this forum: No registered users and 5 guests