Set Form DataSource Programmatically

How do i set the form’s datasource programmatically?

By using the solutionModel. To create a form from scratch and specify a datasource:

var myForm = solutionModel.newForm('newForm', 'myServer', 'myTable', 'myStyleName', false, 800, 600)

Or with an existing form:

var myForm = solutionModel.getForm('newForm');
myForm.dataSource = 'db:/anotherServerName/anotherTableName';

Note that the datasource of an existing form can only be changed if the form hasn’t been loaded/touched yet.

thanks guys