![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a form with an MRO attached (may not be the right word) to a table via the data model. I would like to automate the creation of the table, so I undefined the MRO and removed the table from the data model. When the form opens, I can check for the existence of the table and, if it doesn't exist, create it. Once that's done, I don't see how to attach (define, whatever) the table to the MRO with code. There seems to always be a way to do nearly anything, but you have to find it and I haven't. I know I could use another form to test for and create the table if necessary and then open the original form, but I'm hoping that there's a way to do it within one form. Suggestions? Bill (groping in the dark) __________ Swap first and last parts of username and ISP for address. |
#3
| |||
| |||
|
|
Bill, only a vague remembering: I experimented once with changing the table for a tableframe in a form during runtime. Therefore I changed the ui-property 'tablename': ui.tablename="Mytable.db" But I seem to remember that this broke the design changing field-width and so on. But perhaps it is a trace for you to make own experience. |
#4
| |||
| |||
|
|
On Sat, 4 Feb 2006 22:00:14 +0100, "Egbert Babst" EgbertBabst (AT) BabstSoft (DOT) com> wrote: Bill, only a vague remembering: I experimented once with changing the table for a tableframe in a form during runtime. Therefore I changed the ui-property 'tablename': ui.tablename="Mytable.db" But I seem to remember that this broke the design changing field-width and so on. But perhaps it is a trace for you to make own experience. It worked as you remembered, including reverting to a standard initial field layout, which is definitely unacceptable. I don't see anything else among the properties that looks useful in this regard. Thanks for the info. Bill __________ Swap first and last parts of username and ISP for address. |
#5
| |||
| |||
|
|
Bill Bind at field level instead of table level. |
#6
| |||
| |||
|
|
I have a form with an MRO attached (may not be the right word) to a table via the data model. I would like to automate the creation of the table, so I undefined the MRO and removed the table from the data model. When the form opens, I can check for the existence of the table and, if it doesn't exist, create it. Once that's done, I don't see how to attach (define, whatever) the table to the MRO with code. There seems to always be a way to do nearly anything, but you have to find it and I haven't. snip |
#7
| |||
| |||
|
|
Bill McCray wrote: I have a form with an MRO attached (may not be the right word) to a table via the data model. I would like to automate the creation of the table, so I undefined the MRO and removed the table from the data model. When the form opens, I can check for the existence of the table and, if it doesn't exist, create it. Once that's done, I don't see how to attach (define, whatever) the table to the MRO with code. There seems to always be a way to do nearly anything, but you have to find it and I haven't. snip If the table is the same there is no need to unattach it from the data model (DM). Simply check for it in the init method and create it if required. Mark B. |
#8
| |||
| |||
|
|
That's even better. I thought that a form wouldn't do anything if its data-model tables didn't exist. If it will start and run the INIT method (for everything or just the form itself?), I can indeed check for and create the table there, if needed. The init method fires only for the form. You can do any changes you |
#9
| |||
| |||
|
| That's even better. I thought that a form wouldn't do anything if its data-model tables didn't exist. If it will start and run the INIT method (for everything or just the form itself?), I can indeed check for and create the table there, if needed. The init method fires only for the form. You can do any changes you need to the datamodel. I do this: st1 =dmgetproperty("DatamodelAliasName","Fullname") if not libfsapi.apiisfile(st1) THEN ;apiisfile from Vladimir's library mytbl = create st1 ..... The dangers of creating the tables on the fly are mainly annoyance. If you have an error in your form and and the tables get deleted the form won't run and rebuild the tables for you. To get around this I usually keep a script around with the table building code. BTW the call to apiisfile is from Vladimir's file system api library. Remember that isfile causing a memory leak so use Vladimir's free library instead, http://cust.east.ru/~menkin/. |
#10
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |