createDataSource() errors

I’m using 4.1 final, and trying out the new “createDataSource” feature with solutionModel forms. Can’t get it to work to save me…the below code results in a dialog showing, immediately followed by the errors “Could not retrieve form data” and “Server mem:resource_select_data not found”

Could someone please tell me what’s wrong with the below?

Thanks, greg.

var q = "SELECT resource_id, resource_name FROM resources WHERE is_active = 1 ORDER BY resource_name asc";
var ds = databaseManager.getDataSetByQuery('cfbs',q,[],-1);
var fds = ds.createDataSource('resource_select_data',[DM_COLUMNTYPE.INTEGER,DM_COLUMNTYPE.TEXT]);

var frmName = 'resource_select_dialog';
var frm = solutionModel.newForm('resource_select_dialog',fds,null,'cfbs_main',false,250,250);
frm.newLabel('resource_name',20,20,100,23);

application.showFormInDialog(frmName,10,10,300,300,'Select',true,false);

Greg,

You have 1 arg too many in your call to newForm, look at the signature:
solutionModel.newForm(name,server_name|data_source,[table_name],style,show_in_menu,width,height)

You have to specify either both server_name and table_name or only data_source (as in your case)

Try this:

var frm = solutionModel.newForm('resource_select_dialog',fds,'cfbs_main',false,250,250);

Rob

Thanks, Rob…the following now works.

Next problem…it appears that if I set a new solutionModel form to extend another form, it breaks the datasource link to the dataset.

g.

Greg,

We already fixed that for 4.1.1

Rob