dbTalk Databases Forums  

Attaching a Table to an MRO

comp.databases.paradox comp.databases.paradox


Discuss Attaching a Table to an MRO in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bill McCray
 
Posts: n/a

Default Attaching a Table to an MRO - 02-04-2006 , 02:45 PM






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.

Reply With Quote
  #2  
Old   
Egbert Babst
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-04-2006 , 03:00 PM






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.

Egbert, 21:58 in Germany


"Bill McCray" <McCrayBill (AT) SpringMind (DOT) com> schrieb im Newsbeitrag
news:qq2au1l32qj3a6rmo818v2gg761d4qvfij (AT) 4ax (DOT) com...
Quote:
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.



Reply With Quote
  #3  
Old   
Bill McCray
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-05-2006 , 03:54 PM



On Sat, 4 Feb 2006 22:00:14 +0100, "Egbert Babst"
<EgbertBabst (AT) BabstSoft (DOT) com> wrote:

Quote:
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.


Reply With Quote
  #4  
Old   
Bertil Isberg
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-05-2006 , 04:14 PM



Bill

Bind at field level instead of table level.

--
Bertil Isberg - CTECH
Paradox buglist:
online: http://web.comhem.se/~u82608896/

"Bill McCray" <McCrayBill (AT) SpringMind (DOT) com> skrev i meddelandet
news:59pcu15ves5p7t6lmmde18tgrakkrnavu9 (AT) 4ax (DOT) com...
Quote:
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.



Reply With Quote
  #5  
Old   
Bill McCray
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-05-2006 , 10:16 PM



On Sun, 5 Feb 2006 23:14:16 +0100, "Bertil Isberg"
<bertil.isberg@NOcomhemSPAMdotse> wrote:

Quote:
Bill

Bind at field level instead of table level.
That appears to work. When I assigned just the field name, the field
object size increased and the text was right aligned, when I wanted it
centered. Below is what I found seems to do what I want. I had to
set the size of the field object last to get the size I want.

Var
P Point
EndVar

P = B3333.Size
B3333.FieldName = "[SU.B3333]"
B3333.Alignment = TextAlignCenter
B3333.Font.Size = 28
B3333.Size = P

Thank you for your help.

Bill
__________
Swap first and last parts of username and ISP for address.


Reply With Quote
  #6  
Old   
Mark Bannister
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-06-2006 , 08:06 AM



Bill McCray wrote:
Quote:
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.


Reply With Quote
  #7  
Old   
Bill McCray
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-06-2006 , 10:09 AM



On Mon, 06 Feb 2006 08:06:43 -0600, Mark Bannister
<markRemove (AT) ThisINjection-Moldings (DOT) com> wrote:

Quote:
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.
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.

Bill
__________
Swap first and last parts of username and ISP for address.


Reply With Quote
  #8  
Old   
Mark Bannister
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-06-2006 , 10:36 AM




Quote:
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/.

Mark B.


Reply With Quote
  #9  
Old   
Bill McCray
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-06-2006 , 07:53 PM



On Mon, 06 Feb 2006 10:36:29 -0600, Mark Bannister
<markRemove (AT) ThisINjection-Moldings (DOT) com> wrote:

Quote:

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/.
Hmmm. I hadn't thought of that. I may stick with Bertil's
suggestion. Thanks anyway.

Bill
__________
Swap first and last parts of username and ISP for address.


Reply With Quote
  #10  
Old   
Bill McCray
 
Posts: n/a

Default Re: Attaching a Table to an MRO - 02-12-2006 , 05:43 PM



* Restatement of the problem:

A form with a table in its data model won't open either in execute
mode or design mode if that table doesn't exist. I have create a form
with an MRO that needs its 82 fields attached to a table during
execution. I don't need the table to exist before the form opens, so
I want the form to create the table if it doesn't already exist.

* Further work

Following up on Bertil's suggestion, I built an OPEN routine that
checks for the table, and if it doesn't exist, creates it. It then
attaches each field of the MRO to a field in the table. Unfortunately,
this redefined a lot of things about the field that I had to redefine
in code (position, size, etc). Okay, so far. All that seems to be
working correctly now.

Now I find that, after I have opened the form, the table has been
inserted into the data model. That means that, if the table gets
deleted, the form won't open to recreate it.

* Current solution

Rather than attach the MRO to the table, I have built some routines
into the form that keep the MRO and the underlying table in sync.
Thus, the table never appears in the data model and it doesn't matter
whether the table exists or not before opening the form. If it
exists, the data from a previous run is available to the form; if not,
it gets created.

Bill
__________
Swap first and last parts of username and ISP for address.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.