Hi There Printing table structure (actually all ables in database) is one of the samples in RS Demo Project www.report-sculptor.com Whole code that makes this report is there so you can customize it way you want. See if it can be of any use to you.
HTH Sergio -----Original Message----- From: John Weller [mailto:[email protected]] Sent: Wednesday, February 06, 2013 7:01 PM To: [email protected] Subject: RE: Print Table Structure Thanks to all who replied. I'm coming back to Fox after a couple of years in retirement and have forgotten lots of the little things which made life easier. I've used DISPLAY .... in the past but forgotten it. I like your program Gary and will use it as the output is better formatted than the DISPLAY output - many thanks! Regards John John Weller 01380 723235 07976 393631 > -----Original Message----- > From: ProfoxTech [mailto:[email protected]] On Behalf Of > Garry Bettle > Sent: 06 February 2013 12:00 > To: [email protected] > Subject: Re: Print Table Structure > > On Wed, 6 Feb 2013 09:57:46 -0000, "John Weller" wrote: > > > > > Is there an easy way to print out a table structure? > > > > John Weller > > 01380 723235 > > 07976 393631 > > > > Hi John, > > Hope this message finds you well - roll on the weekend. > > Here's a wee prg, "Struct.prg" that I keep in my home() directory. > If I need a hard copy, I use SET ALTERNATE ON (and TO) and pipe it to > a text > file for email\printing. > > * Struct.prg > > PARAMETERS tcFile > > IF VARTYPE( tcFile) = [C] > tcFile = ["] + FULLPATH( tcFile) + ["] > IF USED( tcFile) > SELECT tcFile > ELSE > SELECT 0 > USE &tcFile > ENDIF > ELSE > IF !USED() > RETURN > ENDIF > ENDIF > > gnFieldcount = AFIELDS( gaMyArray) > > SCATTER TO laRec MEMO > > ? [Structure for table: ] + PROPER( JUSTFNAME( DBF())) > ? [Number of data records: ] + ALLTRIM( TRANSFORM( RECCOUNT(), > [99,999,999])) > ? [Date of last update: ] + TRANSFORM( TTOD( FDATE( DBF(), 1))) > ? [Code Page: ] + TRANSFORM( CPDBF()) > ? > > lcDBF = PROPER( JUSTFNAME( DBF())) > lcSubDir = PROPER( JUSTSTEM( LEFT( ALLTRIM( DBF()), LEN( ALLTRIM( > DBF())) > - LEN( JUSTFNAME( DBF())) - 1))) > > ? [Field Field Name Type Width Dec Example from ] + > lcSubDir + [, ] + lcDBF + [, Record ] + ALLTRIM( TRANSFORM( RECNO(), > [99,999,999])) > ? [----- -------------- ----------- ----- --- ----------------------------------------------- > ---------------------------------] > > FOR nCount = 1 TO gnFieldcount > ? PADL( TRANSFORM( nCount), 5) + [ ] + ; > PADR( gaMyArray( nCount, 1), 14) + [ ] + ; > PADR( GetFieldType( gaMyArray( nCount, 2)), 11) + [ ] + ; > PADL( TRANSFORM( gaMyArray( nCount, 3)), 5) + [ ] + ; > PADL( IIF( gaMyArray( nCount, 4) = 0, [], TRANSFORM( gaMyArray( > nCount, 4))), 3) + [ ] + ; > PADR( TRANSFORM( laRec[ nCount]), 80) ENDFOR ? > ? [** Total **] + SPACE( 25) + PADL( TRANSFORM( RECSIZE()), 5) > > FUNCTION GetFieldType > LPARAMETERS tcInput > RETURN ICASE( tcInput = [C], [Character], ; > tcInput = [Y], [Currency], ; > tcInput = [D], [Date], ; > tcInput = [T], [DateTime], ; > tcInput = [B], [Double], ; > tcInput = [F], [Float], ; > tcInput = [G], [General], ; > tcInput = [I], [Integer], ; > tcInput = [L], [Logical], ; > tcInput = [M], [Memo], ; > tcInput = [N], [Numeric], ; > tcInput = [Q], [Varbinar], ; > tcInput = [V], [Varchar], ; > tcInput = [W], [Blob], []) > > Cheers, > > Garry > > > --- StripMime Report -- processed MIME parts --- multipart/alternative > text/plain (text body -- kept) > text/html > --- > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

