Initial Form Foundsets

Discuss all feature requests you have for a new Servoy versions here. Make sure to be clear about what you want, provide an example and indicate how important the feature is for you

Initial Form Foundsets

Postby jgarfield » Tue Jan 29, 2008 6:29 pm

Case ID: 116119

So, in the past when we have wanted a form to load with an empty foundset, we have attached a method (clearMyfoundset) to the form's onLoad event. Currently in Servoy 3.5.3 it does not appear that this method works any longer. What I seem to see is the following order of events

1. Form gets loaded
2. Database Performance Manger indicates that a query runs selecting X number of records for that table
3. Records get loaded
4. onLoad method fires, foundset gets cleared.

This of course is undesirable because the entire point of having an empty foundset is to cut down on load times.

We have currently started to use databaseManager.setCreateEmptyFormFoundsets() as a solution for the time being, which is mostly working fine. However, in the end this is also an undesirable solution as well, because it forces ALL forms to have this property, which we weren't previously doing. This may be a bug, but we have noticed that sometimes we will load a record into a form before navigating to it, and then after navigating to the form, the record is gone.

My feature request is this, since it appears that Servoy performs a TOP query get the records to load into a foundset, could there be a form property, something like initialRecords, that would be the number of records Servoy should load into that form when the form is first loaded? That way, it could be the default of 200, 0 if you wanted no records, or even 1, if you wanted the foundset to not be empty, but also didn't want to load hundreds of records.
jgarfield
 
Posts: 223
Joined: Wed Sep 28, 2005 9:02 pm
Location: Boston, US

Re: Initial Form Foundsets

Postby martinh » Thu Oct 30, 2008 3:18 pm

I have also an unwanted situation when using databaseManager.setCreateEmptyFormFoundsets()

I also wanted to use the setCreateEmptyFormFoundsets because to many records are loaded.
I have a main form with a dynamic build tabform.

onShow of my main form, I create the tabform (in the example there are fixed names, but in real all names are variables, because it is in my framework)

Code: Select all
forms.chauffeur_tab.elements.tabs.removeAllTabs()
forms.chauffeur_tab.elements.tabs.addTab( forms.percentenboek, '', 'Percentenboek', null,  null,  null,  null,   forms['chauffeur_tab']['chauffeur_to_percentenboek']);


When the initial load was ON, then the correct records were shown. But since I put the initial load OFF, the relation forms['chauffeur_tab']['chauffeur_to_percentenboek'] doesn't have any records
Since there are no parent records, there are no child records to show neither.

But when I select a record in my main form

Code: Select all
controller.find()
chauffeur_id = 51611
controller.search()


I expect that the correct records on the childform are loaded. But that doesn't happen.

So this seems a bug to me. When you define a relation for a tab, it should not matter if at the moment of creation there are records or not.
It happens both in 3.5.7 and 4.0.1
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium

Re: Initial Form Foundsets

Postby jcompagner » Mon Nov 03, 2008 6:02 pm

if you first run this if there are no records in that form:

Code: Select all
forms.chauffeur_tab.elements.tabs.addTab( forms.percentenboek, '', 'Percentenboek', null,  null,  null,  null,   forms['chauffeur_tab']['chauffeur_to_percentenboek']);


and then after that this:

Code: Select all
controller.find()
chauffeur_id = 51611
controller.search()


then yes you have a problem because there is no such relation so the tab is created without a relation so doesnt know how to fill it.

if you look in the debugger what is the value of: forms['chauffeur_tab']['chauffeur_to_percentenboek'] ?
i guess it is null or undefined right?
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8214
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Initial Form Foundsets

Postby martinh » Wed Nov 05, 2008 11:25 am

jcompagner wrote:i guess it is null or undefined right?


Yes indeed

But this is a serious problem. A relation is defined on design time, so it should not depend on if there are records in the foundset or not.

I see lot of records selected because of the default initial load of forms (max 200 records on each form)
And there is one way to avoid that and that is the databaseManager.setCreateEmptyFormFoundsets()

So both parent form and related form are initially empty.
But when I select a record on my parent form, then the related form must get a correct contents.

I think that the problem is that the relation parameter in the addTab() method is not correct.

In script we must use the syntax like in the example:

    forms['chauffeur_tab']['chauffeur_to_percentenboek']

but when using related tabs on designtime, then you define 'chauffeur_to_percentenboek' as relation

In my opinion the relation parameter of the addTab() method must allowed a fixed relationname (just like on design time)

So the coding should be:

    forms.chauffeur_tab.elements.tabs.addTab( forms.percentenboek, '', 'Percentenboek', null, null, null, null, 'chauffeur_to_percentenboek');

where the relation name refers to the relation on the form that contains the tabpanel (marked in red)

In that case you are in line with designtime related tab panels
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium

Re: Initial Form Foundsets

Postby jcompagner » Tue Nov 11, 2008 5:14 pm

i changed it so that you also can use relation names.

also with solution model you can do it also with relation solution objects then just before runtime.
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8214
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Initial Form Foundsets

Postby martinh » Tue Nov 11, 2008 7:22 pm

Will this be available in 3.5.8 also?
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium

Re: Initial Form Foundsets

Postby jcompagner » Thu Nov 13, 2008 2:50 pm

yes 3.5.8 will also have it
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8214
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Initial Form Foundsets

Postby martinh » Thu Nov 13, 2008 2:53 pm

OK Thanks Johan.

When will 3.5.8 be released?
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium


Return to Discuss Feature Requests

Who is online

Users browsing this forum: No registered users and 2 guests