Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need a good method of printing table structures
Message
From
05/07/2005 14:46:38
 
 
To
05/07/2005 12:59:23
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000
Network:
Novell 6.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01029054
Message ID:
01029120
Views:
16
This message has been marked as the solution to the initial question of the thread.
>Greetings All
>I am looking for a means of printing table structures for tables. Display stru is rather crude to put it kindly. Is there not a better way?
>thanx, Vince

Here is ListStru.prg, a procedure I wrote many years ago. It can surely be improved, but it does it's job. It will Browse the structure, and include info about the index tags. If you have a table open, you Do Liststru, else Do ListStru With "yourtable".
Function LISTSTRU
  Lparameters lcFile
  Local lcVar,lcFiletemp,lcSelect,lcOriginal
  lcSelect=Select()
  lcFiletemp=Substr(Sys(2015), 3)
  lcOriginal=Alias()

  If !Vartype(lcFile)='L'
    If !File(lcFile+'.DBF')
      =Messagebox(lcFile+'.DBF does not exist!')
      Return
    Else
      Select 0
      Use (lcFile) Again Shared
    Endif
  Else
    If Empty(Dbf())
      =Messagebox('No file in use!')
      Return
    Else
      Select 0
      Use (lcOriginal) Again Shared
    Endif
  Endif

  lcVar=Juststem(Dbf())
  List Stru To File (lcFiletemp) Noconsole
  Use
  Create Cursor curstemp (Pos N(5), Dummy1 c(2), Name c(16), Type c(20), Width N(5), Dec N(7), Dummy2 c(5), Index c(6), Collate c(11),Nullz c(2))
  Append From (lcFiletemp) Sdf For Pos>0
  Eras (lcFiletemp+'.TXT')
  Go Top
  Brow Last Noedit Noappend Nodelete Title 'Structure of '+lcVar ;
    Fields Pos, Name, Type, Width, Dec:P='@Z 9',Index,Collate,NullS=Iif( Nullz='No',.F. ,.T. )
  If !Empty(lcOriginal)
    Select (lcOriginal)
  Else
    Select (lcSelect)
  Endif
  Use In curstemp

Return
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform