Page 1 of 1

Version 6.0.6 Memory Based Datasource

PostPosted: Thu Apr 26, 2012 11:59 pm
by kwpsd
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?

Re: Version 6.0.6 Memory Based Datasource

PostPosted: Fri Apr 27, 2012 2:33 am
by kwpsd
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!

Re: Version 6.0.6 Memory Based Datasource

PostPosted: Fri Apr 27, 2012 8:58 pm
by kwpsd
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!

Re: Version 6.0.6 Memory Based Datasource

PostPosted: Tue May 01, 2012 12:57 am
by kwpsd
No response...bug reported. SVY-2122
.

Re: Version 6.0.6 Memory Based Datasource

PostPosted: Tue May 01, 2012 8:57 am
by jcompagner
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..

Re: Version 6.0.6 Memory Based Datasource

PostPosted: Tue May 01, 2012 6:55 pm
by kwpsd
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.

Re: Version 6.0.6 Memory Based Datasource

PostPosted: Thu May 03, 2012 1:08 pm
by jcompagner
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()