how to program table creations

I was wondering if a tool exists that would take a flat text file like:

“Name”,“Char”,“DOB”,“Date”,“Address”,“Char”,…

and create the table with that structure in sybase 10?

This could really speed up conversions from FileMaker…

Thanks,

Wow, your second post :)

Have you actually read the docs?

Have you seen docs talking about Sybase Central? You can download it on the downloads section of Servoy.
It will do what you want…

Could you not export the data tables into a CSV file (or a flat text file where the delimiter is space or whatever) then create your own program (Servoy or another language) to read this text file line by line and populate tables with the fields? Admittedly not a “zero” effort but doable. This way you can also ensure the relationships are also maintained.

I had to do it this way when converting legacy DBase data tables into MySQL. A custom program ensured that pk’s where properly maintained.

Of course the database server provider might also have the language constructs to read form a CSV or text file and populate tables.

it2be:
I actually do have sybase central, and I did use it to create my first database. I did not see anything about scripting it. I will go back and look again.
Thomas:
Your approach is likely what I will do, and I was admittedly looking for a tip file or some article along these lines. I fall asleep reading the servoy manuals each night and THEY ARE GOOD however I greatly miss the profusion of example files on every subject that I had with filemaker. I can learn from manuals but a code snip or example and even a general answer such as yours is very valuable to me. I have written methods that will parse name value pairs and place the values into the correct fields. I am not clear on how to read the text file in, nor on how to create an entry in a table. Scott Butler suggested rawSQL plugin, but when I looked at that the warning said caution: not for the beginner…
it2be:
I have posted more than twice, I simply deleted the posts when the answers became painfully obvious. Example: I was not able to import the few exported examples that I found because on Mac the OS seems to unzip the zipped files automatically and puts the original in the trash. even if the file is example.servoy? I had several folders like export, export-1, export-2, export-3 that I just discovered to my delight WILL import from the admin page of the browser if I first zip them. I am still struggling with concepts and I hope I am not posting to the wrong part of the forum.

I had several folders like export, export-1, export-2, export-3 that I just discovered to my delight WILL import from the admin page of the browser if I first zip them.

Your .servoy file was 99% sure unpacked.
By zipping it it has its old structure again.
Did not know you could do that though.
I was under the impression Servoy would always check some sort of checksume…

Just a thought…

You could script table creation like so:
var sql = ‘CREATE TABLE Orders (’;
sql += ‘order_num INTEGER NOT NULL PRIMARY KEY,’;
sql += ‘date_ordered DATE,’;
sql += ‘name CHAR(80));’;
sql += ‘CREATE TABLE Order_item(’;
sql += ‘order_num INTEGER NOT NULL,’;
sql += ‘item_num SMALLINT NOT NULL,’;
sql += ‘PRIMARY KEY(order_num, item_num),’;
sql += ‘FOREIGN KEY (order_num)’;
sql += ‘REFERENCE Orders (order_num)’;
sql += ‘ON DELETE CASCADE)’;

var done = plugins.rawSQL.executeSQL(controller.getServerName(),null,sql, null);
if (done){
application.output(‘success!’);
}
else {
var msg = plugins.rawSQL.getException().getMessage();
plugins.dialogs.showErrorDialog(‘Error’, 'SQL exception: '+msg, ‘Ok’)
}

You could load the tables from text files exported from Filemaker, like:

var sql = “LOAD TABLE Orders FROM ‘Orders.txt’”;
var done = plugins.rawSQL.executeSQL(controller.getServerName(),null,sql, null);
if (done){
application.output(‘success!’);
}
else {
var msg = plugins.rawSQL.getException().getMessage();
plugins.dialogs.showErrorDialog(‘Error’, 'SQL exception: '+msg, ‘Ok’);
}

You can get references to the SQL examples from the online documentation of SQL Anywhere. Also, you would probably have to restart Servoy Developer in order to see the new tables.

Kyle Schell

Great post but you NEED to know about SQL before you start doing that!
That is also the background of the warning for using the RawSQL plugin
Also, when you do this from within Servoy you need to flush/restart Servoy before it can recognize the new table.

Point well taken. You can also check out FMPro Migrator. This software tool generates scripts that will migrate Filemaker tables and data to Sybase tables that can be used with Servoy.

Kyle Schell

eyeGuy:
Point well taken. You can also check out FMPro Migrator. This software tool generates scripts that will migrate Filemaker tables and data to Sybase tables that can be used with Servoy.

Yes, but the point is: if Charles is coming from a totally different background ( FileMaker, in this case), is it a good idea to leave to an automated tool the design of the entire db?
In my opinion, some fondamental concepts of SQL are not optional, so I would suggest to learn some SQL basics (if you want to use Sybase Central, RawSQL or, why not, a script in FileMaker that does the job). Otherwise, I think it’s much safer to create the db using Servoy.

PS: Anyway, your method is great. Congratuations. :-)

There are many ways to bringing over Filemaker tables. The greater challenge with Filemaker conversions is converting data over if you are re-architecting the data structures. Which you should be doing in practically every situation :)

If you’re not a SQL guru yet, one easy trick is to create the new data structure using Filemaker and then using your new Filemaker tables as your Servoy conversion source:

http://www.servoymagazine.com/home/2007/06/article_getting.html

I just created my first calculated field in servoy/sqlanywhere. I am starting to see why it wouldn’t help all that much…

many thanks,
charles

Also, a free tool that is really helpful to transfer both FileMaker data and schema to Servoy is our friend Scott Butler’s FM Escape - see http://forum.servoy.com/viewtopic.php?f=22&t=11160#p56390.

Hope this helps,

Ben

has anyone tried the link for fm escape? I can’t get it to work…

thanks
Charles

Try this one FM Escape- Migrate FileMaker Schema and Data to SQL - Classic Servoy - Servoy Community

Thanks Graham, I copy-pasted the wrong link :roll: - this http://forum.servoy.com/viewtopic.php?f=4&t=6402&start=60 may also be useful.

Cheers,

Ben