V4RB2 vLink

erne ernestogiannotta at tiscalinet.it
Thu Dec 30 12:01:17 CST 2004


on 30-12-2004 11:05, Ruslan Zasukhin at sunshine at public.kherson.ua wrote:

> On 12/30/04 10:17 AM, "erne" <ernestogiannotta at tiscalinet.it> wrote:
> 
>>>> after all we are required to know the Index order of linked tables if
>>>> we must link records by:
>>>> vLink.LinkRecords( inRecIDs() as Integer )
>>> 
>>> Agree. Index of table is strict thing.
>>> It correspond to the order of creation.
>>> 
>>>> anyway, to specify the 2nd table seems redundant as we have:
>>>> vLink.DeleteLinkedRecords( inRecID as Integer, inTableA as VTable )
>>>> vLink.DeleteAllLinkedRecords( inTableA as VTable )
>>>> 
>>>> so it should be enough:
>>>> vLink.FindLinked( inRecID as Integer, inTableA as [VTable or Integer] )
>>>> as VSet
>>> 
>>> I see your point...and
>>> 
>>>> unless vLink will be able to link more than 2 tables in the future
>>> 
>>> Exactly! Bingo! :-)
>>> 
>>>> in which case the LinkRecords, DeleteLinkedRecords and
>>>> DeleteAllLinkedRecords methods must be updated
>>> 
>>> NO. because when link will have 3 branches, I still can say
>>> 
>>> vLink.DeleteAllLinkedRecords( inTableA as VTable )
>>> 
>>> And this means break links to ALL linked tables of TableA.
>>> 
>> 
>> still
>> 
>> vLink.LinkRecords( inRecIDs() as Integer )
>> 
>> remains not consistent... it does not give way to specify link direction
> 
> and
> 
>> should be
>> 
>> vLink.LinkRecords( inRecIDs() as Integer, inTableA as VTable, inTableB as
>> VTable )
>> 
>> just like in the vLink.FindLinked syntax
> 
> No no no.
> 
> When you create link you specify order of tables:
> 
> db.CreateBinaryLink( ... T1, T2 ...)
> 

that's why I asked option to refer them by index also

> So when you want link 2 records of these tables you do
> 
> link.LinkRecords( Array( 3, 5) )
> 
> And you and Valentina know that
> 
> 3 -- this is RecID of T1
> 5 -- this is RecID of T2.
> 
> Direction is not important here. Absolutely.

still... this limits linked tables to 2 and not more

and... 
what about a 2 dimensional array to link several record pairs at once?

e.g.
dim LinksArray(2,2)

LinksArray(0,1) = 3  //-- this is RecID of T1
LinksArray(0,2) = 5  //-- this is RecID of T2
LinksArray(1,1) = 3  //-- this is RecID of T1
LinksArray(1,2) = 6  //-- this is RecID of T2
LinksArray(2,1) = 4  //-- this is RecID of T1
LinksArray(2,2) = 5  //-- this is RecID of T2

link.LinkRecords( LinksArray, T1, T2 ) //  specify Tables for future
                                           multitables links


imagine this:

dim LinksArray(1,3)

LinksArray(0,1) = 3  //-- this is RecID of T1
LinksArray(0,2) = 5  //-- this is RecID of T2
LinksArray(0,3) = 5  //-- this is RecID of T3
LinksArray(1,1) = 3  //-- this is RecID of T1
LinksArray(1,2) = 6  //-- this is RecID of T2
LinksArray(1,3) = 4  //-- this is RecID of T3

link.LinkRecords( LinksArray, T1, T2, T3 ) //  specify Tables for future
                                               multitables links


Cool Runnings,
Erne.

-- 
| e r |  Ernesto Giannotta
| n e |  Musical Box - a media store
                   




More information about the Valentina-beta mailing list