Child vs parent records
Ruslan Zasukhin
sunshine at public.kherson.ua
Mon Nov 14 23:38:39 CST 2005
On 11/14/05 10:49 PM, "Ed Kleban" <Ed at Kleban.com> wrote:
Hi Ed,
>> * this should be used only for SELF-recursive links
>
> Yes, I understand. That's exactly what I want to use it for.
>
>> * so image Table "Person".
>> And Let it have link "Born To" of kind M : M (actually 2 : M)
>>
>> * let you have record with RecID = 100 and it is person "John Johnson".
>> this record have linked records.
>> but look! This linked records are of 2 kinds: Parents and Childs.
>>
>> So when you do
>>
>> found = FindLink( 100, tblPerson, tblPerson, ??? )
>>
>> Who you want to find? Parents or Childs?
>> Last parameter allow you specify this.
>
> Yes, I understand all of this also.
> However I still can't tell from the description in the document which record
> "child" refers to and which record "parent" refers to.
Aha, I see. Look again on method:
found = FindLink( 100, tblPerson, tblPerson, ??? )
^^^^^^^ ^^^^^^^^
parent child.
> The text states: " If you specify kFromParentToChild then the function will
> use child records of the inRecID record. Otherwise it will use parent
> record(s) of the inRecID record."
>
> What do you mean by "child records of the inRecID record"?
> What do you mean by "parent record(s) of the inRecID record?
Okay, let me try to explain.
We have recursive link. Recursive link can in fact be written as:
Table1 --- Link --- Table1
So it similar to
Table1 --- Link --- Table2
Right?
We often write 1 : M link between 2 tables as:
ParentTable -- link -- ChildTable
Right?
So if you in brain unroll recursive link as above, you can think that LEFT
table is PARENT table, ad RIGHT table is CHILD table.
If take example with "Person" table and link "ParentOf"
Person ----- ParentOf ------ Person
^^^^^^ ^^^^^
parent child
> Is child vs parent determined by which is specified as TableA vs TableB?
For 2 different tables YES!
For recursive link, they are the same, THIS IS WHY we need this last
parameter: to specify direction of hierarchy.
> Are parents always the records in tableA that have a recID value that is
> equal to the ObjectPtr field value in Table B; And therefore children are
> the records that have an ObjectPtr field value in Table B matching the recID
> of TableA?
> The terms "parent" and "child" simply have no meaning here without
> definition. There must be something that you understand implicitly about
> what a parent or child is that simply isn't documented here.
>
> Or perhaps there's something explicit here that I'm simply not getting.
I hope now it is more clear. Yes we need write a lots more text in docs
about this .
>> P.S. Hmm... May be in fact we can make MORE functions to make things more
>> clean...
>>
>> FindLinked( recid, T1, T2 )
>> FindLinkedRecursive( recid, T, inRecursionDirection )
>
> An interesting idea, but sheds on light on the question I have.
Hmm, or even better idea!
It looks more natural as
set = TableA.FindLinkedTo( ThisRecID, ByThisLink, InTableB );
// and for recursive links:
TableA.FindChildsOf( ThisRcID, ByThisLink )
TableA.FindParentsOf( ThisRcID, ByThisLink )
Problem is that somebody can use this for non-recursive ...
May be its possible to prevent this ... It needs to think about this .
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list