# Version 6.0.6 Memory Based Datasource

**URL:** <https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870>\
**Category:** Classic Servoy\
**Created:** [April 26, 2012, 9:59pm UTC](https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870 "2012-04-26T21:59:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [April 26, 2012, 9:59pm UTC](https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870/1 "2012-04-26T21:59:11Z")

</div>

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:

```auto
    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?

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [April 27, 2012, 12:33am UTC](https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870/2 "2012-04-27T00:33:27Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [April 27, 2012, 6:58pm UTC](https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870/3 "2012-04-27T18:58:17Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [April 30, 2012, 10:57pm UTC](https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870/4 "2012-04-30T22:57:21Z")

</div>

No response…bug reported. SVY-2122  
.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [May 1, 2012, 6:57am UTC](https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870/5 "2012-05-01T06:57:43Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [May 1, 2012, 4:55pm UTC](https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870/6 "2012-05-01T16:55:53Z")

</div>

Hi, Johan.

Regarding your comment on using:

```auto
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.

---

<div class="post-metadata">

**Author:** ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)\
**Post date:** [May 3, 2012, 11:08am UTC](https://forum.servoy.com/t/version-6-0-6-memory-based-datasource/15870/7 "2012-05-03T11:08:21Z")

</div>

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)

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

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

```
