Thanks everyone for all the input.  At this point I my code scans through
multiple databases doing the following for several hundred tables:

   - Loop through the original table to build a cursor with the memo fields
   converted to character fields
   - Build a header string with field names consisting of both the long and
   real field names
   - Copy the original table to a TMP file type delimited
   - Create a new low level file with a CSV extension
   - Write the header to the new file
   - Write the TMP file to the new file
   - Delete the TMP file

This gives me files that can be opened in Excel with the full field names
and most of the data.  They can be used by non programmers to evaluate what
data needs to be imported into a new system.

I had hoped that the Foxpro team provided a syntax to allow coding using
the long file names.  Perhaps that would have been in version 10 - to bad.

Thanks again,

Joe

   -


On Wed, Apr 15, 2015 at 9:40 PM, Ken Dibble <[email protected]> wrote:

>
>  When there is a table that is part of a database (DBSTAFF) I can browse it
>> and it automatically opens the database and shows the long field names as
>> headers. When I do a "select * from DBSTAFF" I get a cursor with the long
>> field names as headers.  My question is "What syntax do I use specify
>> specific field names if I don't want them all?
>>
>
> Joe,
>
> ** Completely Untested Pseudo-Code **
>
> It's probably going to be something like this, using an in-line UDF in the
> query:
>
> SELECT GetRealFieldNameFor("MyTable","My Long Field Name") AS LongName1,
> GetRealFieldNameFor("MyTable","My Other Long Field Name") AS Longname2
> FROM MyTable INTO CURSOR Whatever
>
> FUNCTION GetRealFieldNameFor(cTable,cFieldName)
>      LOCAL therow, thereturn
>
>      therow = 0
>      thereturn = ""
>
>      * Get an array of long names and short names for fields.
>      ASOMEUSEFULDBCARRAYFUNCTION(aMyArray,parms)
>
>      therow = ASCAN(aMyArray,cFieldName,-1.-1.[whatever column),15)
>
>     IF therow > 0
>          thereturn = aMyArray(therow,[whatever column])
>     ELSE
>          * Massive problem that will hose your query in an un-fixable
> manner.
>     ENDIF
>
>     RETURN thereturn
> ENDFUNC
>
> This is NOT TESTED. It would probably take a couple hours to figure it out
> completely. The other suggestions people have made regarding querying the
> properties of a database should get you there.
>
> It's probably going to be waaaaaay sllooooow...
>
> And, of course, it will only work in VFP SQL.
>
> You are better off constructing a data dictionary table in advance and
> pulling the translations from it to build your query expressions.
>
> Ken Dibble
> www.stic-cil.org
>
>
[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/cabqednxn9cm2rbt64dmrarz3q0mpmz+gmspxusws7x4cj6z...@mail.gmail.com
** 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.

Reply via email to