Version 6.0.6 Memory Based Datasource

Questions and answers for designing and implementing forms in Servoy

Version 6.0.6 Memory Based Datasource

Postby kwpsd » Thu Apr 26, 2012 11:59 pm

Version: 6.0.6 - build 1232

A couple of days ago we upgraded our development platform from version 6.0.5 to 6.0.6.

The following code worked in 6.0.5 (and below), however, it no longer works in 6.0.6:

Code: Select all
    var oForm = solutionModel.getForm( 'formName' )
   
        oForm.dataSource = dataset.createDataSource( 'userData' )

    controller.recreateUI()

The above code is used to restrict what is displayed on the form (via getDataSetByQuery()), however, now the form displays the entire table content on which the form is based and not the dataset.

Has anyone else run into this? Bug?
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Version 6.0.6 Memory Based Datasource

Postby kwpsd » Fri Apr 27, 2012 2:33 am

I discovered that if I set the form's datasource to 'none', the form works as expected using the same code (by the way, this code is in the onLoad() method of the form).

Problem solved!
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Version 6.0.6 Memory Based Datasource

Postby kwpsd » Fri Apr 27, 2012 8:58 pm

I spoke too soon!

The code works in Developer but not when deployed to a production server (with no Developer). I verified that the dataset is identical in both Developer and the production server. Also, Developer and the production server are running version 6.0.6 - build 1232. There are no errors in the server log.

What else can I do to determine why this is not working? I tend to believe that something changed in going from version 6.0.5 to 6.0.6 (bug)...perhaps, someone from Servoy could offer a suggestion? Any help would be appreciated.

Thanks!
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Version 6.0.6 Memory Based Datasource

Postby kwpsd » Tue May 01, 2012 12:57 am

No response...bug reported. SVY-2122
.
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Version 6.0.6 Memory Based Datasource

Postby jcompagner » Tue May 01, 2012 8:57 am

we will look at it but just a remark:

oForm.dataSource = dataset.createDataSource( 'userData' )
controller.recreateUI()

oForm == the current controller?

So controller.recreateUI() reflects the form with the new datasource?
Even if done in onload that could be quite a bit to late. Because recreateUI doesn't do anything related to data (so the datasource) it just recreates the UI (what the method name also says)

But it could be that because you do it in the onload the foundset was not yet set and then it just uses that new datasource, but that is quite a bit of a maybe..
You should set datasources before showing or loading the form at all..
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet

Re: Version 6.0.6 Memory Based Datasource

Postby kwpsd » Tue May 01, 2012 6:55 pm

Hi, Johan.

Regarding your comment on using:

Code: Select all
controller.recreateUI()


Without this code, the following error is emitted:

Stale form(s) detected, form(s) were altered by the solution model without destroying them first


Regarding when to load datasources:

You should set datasources before showing or loading the form at all..


How do you set the datasource of a form that doesn't yet exist?

My understanding is that all forms reside in the repository until invoked (loaded) and that the 'onLoad()' event is the developer's first opportunity to modify the form, including the datasource. Perhaps, you could provide an example?

Thank you for looking into this matter.
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 687
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Version 6.0.6 Memory Based Datasource

Postby jcompagner » Thu May 03, 2012 1:08 pm

the onload method is fired when the runtime instance is created of that form
But then you are to late by altering the blue print of the form (solution model JSForm)

before touching at runtime the form you should already alter the JSForm first (so in your solution startup or something)

Code: Select all
var jsform = solutionModel.getForm("myform");
jsform.datasource = x;

// only now show it:
forms.myform.controller.show()
Johan Compagner
Servoy
User avatar
jcompagner
 
Posts: 8828
Joined: Tue May 27, 2003 7:26 pm
Location: The Internet


Return to Forms

Who is online

Users browsing this forum: No registered users and 7 guests