Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List of indexes
Message
From
11/06/2009 17:02:06
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
11/06/2009 16:04:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01405333
Message ID:
01405368
Views:
49
>>>Hi All:
>>>
>>>Is there a way to return a array of indexes in an associated CDX for a given tables together with their respective keys?
>>>
>>>Thanks,
>>>
>>>Yossi
>>
>>
>>
GetFieldsAndIndexes(_samples+'data')
>>Select crsStructs
>>Locate
>>Browse
>>Select crsINDEXES
>>Locate
>>Browse
>>
>>Procedure GetFieldsAndIndexes(tcDataDir)
>>  tcDataDir = Addbs(m.tcDataDir)
>>  Create Cursor crsStructs ;
>>    (FIELD_NAME C(128) NoCPTrans, ;
>>    FIELD_TYPE C(1), ;
>>    FIELD_LEN N(3, 0), ;
>>    FIELD_DEC N(3, 0), ;
>>    FIELD_NULL L, ;
>>    FIELD_NOCP L, ;
>>    _TABLENAME M NoCPTrans)
>>  Create Cursor crsINDEXES ;
>>    (TAG_NAME C(10) NoCPTrans, ;
>>    KEY_EXPR M, ;
>>    NDXTYPE C(1), ;
>>    IS_DESC L, ;
>>    FILTEREXPR M NoCPTrans, ;
>>    _TABLENAME M NoCPTrans)
>>  Select 0
>>  lnTables = Adir(arrTables,m.tcDataDir+'*.dbf')
>>  For ix=1 To m.lnTables
>>    Use (m.tcDataDir+arrTables[m.ix,1])
>>
>>    lnFields=Afields(arrStruc)
>>    For jx=1 To m.lnFields
>>      arrStruc[m.jx,7]=arrTables[m.ix,1]
>>    Endfor
>>    Insert Into crsStructs From Array arrStruc
>>    Release arrStruc
>>    If Tagcount()>0
>>      Dimension arrIndexes[tagcount(),6]
>>      For jx=1 To Tagcount()
>>        arrIndexes[m.jx,1] = Tag(m.jx)
>>        arrIndexes[m.jx,2] = Key(m.jx)
>>        arrIndexes[m.jx,3] = Iif(Primary(m.jx),'P',Iif(Candidate(m.jx),'C',Iif(Unique(m.jx),'U','R')))
>>        arrIndexes[m.jx,4] = Descending(m.jx)
>>        arrIndexes[m.jx,5] = Sys(2021,m.jx)
>>        arrIndexes[m.jx,6] = arrTables[m.ix,1]
>>      Endfor
>>      Insert Into crsINDEXES From Array arrIndexes
>>    Endif
>>
>>    Use
>>  Endfor
>>
Cetin
>
>Cetin:
>
>Very elegant, but wouldn't ataginfo() be easier, as Naomi points out?

When I originally wrote this ataginfo() was not available as I remember. I don't know if ataginfo() is nay better. Might be.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform