main logo
Subject: Re: NextRecord and ObjectPtr?
Author: Ruslan Zasukhin
Posted: 2006/04/30 07:00:46
 
View Entire Thread
New Search


On 4/30/06 2:06 PM, "Joakim Schramm" <joakim /at/ astrocalc .DO.T com> wrote:

> Dim IdRec As Long
> Dim B As Boolean
> Dim sKey As String
> Dim fldPtr As VField
> Dim fldFK As VField
> Dim fldPK As VField
> Dim mTblCountry As VTable
> Dim mTblAlias As VTable
>
> 'prepare binary links
> 'Set mLinkCA = mDatabase.Link(lnkCountryAlias)
> Set mTblCountry = mDatabase.Table(tblCountry & sLang)
> Set mTblAlias = mDatabase.Table(tblCountryAlias)
>
> With mTblAlias
> Set fldPtr = .Field("PtrAlias")
> Set fldFK = .Field("CID")
> Set fldPK = mTblCountry.Field("CID")
> Call .FirstRecord
>
> Do While Not .EOF
> sKey = Trim$(fldFK.Value)
> IdRec = fldPK.FindSingle(sKey)
>
> If IdRec <> 0 Then
> fldPtr.Value = IdRec
> .UpdateRecord
> Else
> MsgBox "No " & sKey
> End If
>
> B = .NextRecord
> Loop
>
> End With

Joakim,

1) am I right that you here convert FK-link to ObjectPtr link ?
it seems yes.

2) you do iteration by MANY table, and use FindSingle() to find record in
ONE table.

This is not best way. Better do reverse:
iterate ONE table, and do FindLinked().


3) But, even simpler!

Valentina can do this operation for you.
look on method VObjectPtr.ConvertRDBLink()

also exists analog SQL command

4) we have no yet similar function to convert FK to BinaryLink.
in WIKI on Vlink pages, this set of tasks is named REFACTORING of links.
We need yet develop it to get complete picture

--
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]


_______________________________________________
Valentina mailing list
Valentina@lists.macserve.net
http://lists.macserve.net/mailman/listinfo/valentina

 
©2006 Ruslan Zasukhin
<-- Prior Message New Search Next Message -->