March 15, 200619 yr After 2 1/2 not totally pleasant months, one of the databases im working on is almost finished (yay). Now comes the fun part, exporting and importing, with 46 tables, the actual export script shouldnt be to difficult, however my query comes about the serial keys. Almost all of my tables have an incrementing primary key. A) I forgot the functions to pull out (and set) the next serial key in the particular field of a table. I have no idea where to store them so that i can restore them after an import. Cheers for help, I really am not thinking to well lately so thanks for putting up with my fun questions. ~Genx
March 15, 200619 yr The import "wizard" has a setting to disable auto-enter on the imported records, so your old primary keys are safe if you choose that option. All you'd need to do is reset the "next" value in the pk's field definition.
March 15, 200619 yr Author Well, that solves one problem, but, lets say i export all my records, where would i store the "next" serial value for a particular table so that i could set / "restore" it in the other file? Thanks, ~Genx
March 15, 200619 yr Author Maybe a global field that stores the last serial? I import that into the other file and restore that value using a script. Would this work?
March 15, 200619 yr There is a special Design function, GetNextSerialValue ( fileName ; fieldName ) Now, it has a weakness, in that both the file name and the field name may need to be entered as plain text. But when doing such an "update" routine you would know the file name and the field name (which would be an auto-entered serial ID field). You'd use a special script step also. The whole thing looks like: Set Next Serial Value [ GetNextSerialValue ( fileName; fieldName ) ] And be grateful that you are "Young & Reckless", because what we had to do before FM added these was really awful, multiple Replaces to increment the number.
March 15, 200619 yr Author Hehe, i love it, Thanks Fenton. I assume field name would be entered in the format "tablename::fieldname", and both files would have to be open. Based on this assumption, yay, i never really thought of having both files open at once. So thanks again guys. ~Genx
Create an account or sign in to comment