Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parent table name
Message
De
19/11/2007 07:41:45
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01269840
Message ID:
01269855
Vues:
10
>hi,
>how can i find parent table in relation tables.
>
>Set Relation to AccountID Into AccountType In Accounts
>
>Accounts
>-----AccountType
>
>I know accounttype table name, I Want find "Accounts" table name.
>
>thanks for your helps

Özgür,
A child table legally can have multiple parents:
loParents = FindParents("AccountType")
For ix = 1 To loParents.Parents
  ? loParents.aParent[m.ix].ParentAlias, loParents.aParent[m.ix].RelationalExpr
Endfor

Function FindParents(tcChild)
  Local Array aTables[1]
  Local ix,jx, oParentInfo, lnParents
  oParentInfo = Createobject('Empty')
  AddProperty(oParentInfo,'Parents',0)
  AddProperty(oParentInfo,'aParent[32767]')
  For ix=1 To Aused(aTables)
    For jx=1 To 32767
      If Empty(Relation(m.jx,aTables[m.ix,1]))
        Exit
      Endif
      If Target(m.jx,aTables[m.ix,1]) == Upper(m.tcChild)
        oParentInfo.Parents = oParentInfo.Parents + 1
        oParentInfo.aParent[oParentInfo.Parents] = Createobject('Empty')
        AddProperty(oParentInfo.aParent[oParentInfo.Parents],;
          'ParentAlias',aTables[m.ix,1])
        AddProperty(oParentInfo.aParent[oParentInfo.Parents],;
          'RelationalExpr',Relation(m.jx,aTables[m.ix,1]))
      Endif
    Endfor
  Endfor
  Dimension oParentInfo.aParent[MAX(oParentInfo.Parents,1)]
  Return oParentInfo
Endfunc
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform