Subject Re: Parent/Child
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 6 May 2021 10:17:09 +0200
Newsgroups dbase.getting-started

On 2021/05/05 18:08, Bob McKinney wrote:
> Hi All:  Using dB Plus 2.8 w/win/10, age 97 (have forgotten a lot) . I can no longer establish
> Parent/ Child relations when creating a new datamodule.  I tried to reinstall dB from my
> backup disk but it won't install, in case dB acquired a glitch of some kind.
>     I only code for my personal use.  Any help regaining this capability of dB would be a great help as I am now having to try to code workarounds.  Not too great.  I know it's old code, but maybe someone knows how to regain this feature.  Thanks for any help.......Bob
>

Re-installing dBASE Plus 2.8 over a corrupt copy may work but there is
also the chance that you will wind up with no dBASE at all.  You should
only consider this is if you have your dBASE 2.7 licence which will
enable you to start from scratch.

As I remember it, dBASE Plus 2.8 was a free upgrade to dBASE Plus 2.7.
If your copy of dBASE Plus 2.8 is corrupt and if you have your licence
for dBASE Plus 2.7 you can download and install dBASE Plus 2.7 from
http://www.dbase.com/support/updates-and-fixes/    Once that is done you
can download and install dBASE Plus2.8 over it.

If you no longer have your dBASE Plus 2.7 licence you can try writing to
customerservice@dbasellc.com where they may be able to help you. This
may, however, be a bit of a long shot as the present owners of dBASE may
not have access to those records.

There have been changes to the datamodule designer over the years. I
never used dBASE 2.8 so I can't help you with the datamodule designer

Datamodules are very useful especially where many of the same tables are
used on many forms.  One does not, however, need to use them.  It may be
a bit more work but there is nothing to stop you from adding all the
tables to each form instead of a single datamodule.

Once you have added tables to a datamodule (or a form) you can set the
relationship by using the sourcecode editor.

There are two different ways of setting up a parent/child relationship
but let's stay with the more traditional one here.

You need to open each table in it's own query.  The parent table need
not be indexed but you can use an index if you want.  This index can be
on any field in the parent table.

The child table MUST be indexed on the field that is used to link it to
its parent.

You need to set three things for the child rowset.

   1  The indexname for the child rowset.  The indexname is not
important. It's index expression must, however, have the linking field
at the start of the expression if it is a complex index.
   2  Assign the parent rowset to to the child rowset's masterRowset
property.
   3  Assign the name of the linking field in the child rowset to the
child rowset's masterFields property.

Once this has been done selecting a record in the parent rowset will
automatically select the appropriate records in the child rowset.

    this.PARENT1 = new QUERY(this)
    with (this.PARENT1)
       left = 4.0
       width = 10.0
       height = 1.0
       sql = 'select * from "parent.DBF"'
       active = true
    endwith


    this.CHILD1 = new QUERY(this)
    with (this.CHILD1)
       left = 13.0
       width = 7.0
       height = 1.0
       sql = 'select * from "child.DBF"'
       active = true
    endwith

    with (this.CHILD1.rowset)
       indexName = "CHILDID"  // name of index for child table
       masterRowset = form.parent1.rowset //parent rowset
       masterFields = "childid" // name of linking field in parent table
    endwith


Mervyn.


Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0