Version 6.0.6 Memory Based Datasource

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:

    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?

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!

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!

No response…bug reported. SVY-2122
.

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…

Hi, Johan.

Regarding your comment on using:

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.

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)

var jsform = solutionModel.getForm("myform");
jsform.datasource = x;

// only now show it:
forms.myform.controller.show()