I am writing an application which automatically converts FileMaker layouts, scripts and relationships to Servoy - but I am having trouble getting a simple form to be created. I suspect that I am just missing something simple in my knowledge of using Servoy. I am using the following code posted in one of the previous forum posts:
var fname = "testform"
if (!forms[fname])
{
// create dataset
ds = databaseManager.createEmptyDataSet()
ds.addColumn("x_id")
ds.addColumn("bla t")
ds.addRow([100, 'aap'])
ds.addRow([101, 'noot'])
ds.addRow([102, 'mies'])
//Create a new data source, returns an uri that can be used to build forms on
var uri = ds.createDataSource('mydata', [DM_TYPE.INTEGER, DM_TYPE.TEXT]);
// create form
var jsform = solutionModel.newForm(fname, uri, null, true, 300, 300);
jsform.newTextField("x_id",100,100,100,20);
jsform.newTextField("bla_t",100,130,100,20);
}
application.output(fname)
forms[fname].controller.show()
I selected the code to run after saving the .js file, and expected to see the new form “testform” show up in the list of forms in the solution explorer - but nothing happened. The code seemed to run without error, but no forms were created. Any ideas?
A few other questions I have are:
- How can I load and run a whole group of files, such as: form1.js, form2.js, form3.js ?
I need to convert FileMaker files having hundreds of layouts, so I need to automate this process of running the forms code which I have generated. - Is there an example showing how to create a graphic image object on a form using an existing media object which has already been imported into the project?
- How can I save each form which has been created? I read somewhere that these forms are created in memory and something extra needs to be done to actually save them into the project.