solutionModel datasource

Hello,

I am building a form via solutionModel with the dataset from a stored procedure.

var ds = databaseManager.createEmptyDataSet()

// build data structure from results from stored procedure code skipped

var dataSrce = ‘customer_to_orders’
var datasource = ds.createDataSource(dataSrce)
var formName = ‘testForm’

var myForm = solutionModel.newForm(
formName,
datasource,
‘standard_style’,
false,
200,
200
)

myform gets built and everything is wonderful.

My question is: Does a method call exist to get a handle to the datasource/dataset of the generated form?

thx
lach

Lachness:
My question is: Does a method call exist to get a handle to the datasource/dataset of the generated form?

Can you explain a bit more?

I will try…

The DataSet (ds) is populated from a procedure call. It is made up of rows of data.

It is converted into a datasource for the form. The datasource name looks like: “mem:customers_to_orders”

Further down in the application I would like to grab the generated form and get access to the datasource it is based on.

I would like to manipulate the data or copy the data without having to execute the procedure again.

I hope I am being clearer. Is it possible in Servoy?

thx
lach

Once a dataset has been added as a datasouce to a form, you can access it via the foundset of this form, so in your case:

forms.testForm.foundset

will give you access to your data.

Beware though that you cannot modify the structure of this datasource (just like you cannot modify the structure of a foundset based on a table)
If you do so, you will have to create a new one.

Hi Patrick,

Thx for info, works like a charm, saved a procedure call. Gotta luv that.

Lach