I think your 'kludgey' approach is the one I would use. Being in FoxPro it will only take a few minutes to code and even less time to run :-) You could have the answers in the time it would take to identify and create a more sophisticated approach.
John John Weller 01380 723235 07976 393631 > > Goal: to determine maximum field widths for entire input/text file. > > Input file is Sample.txt. It contains 'n' fields, let's say 5 for this > example: Field1, Field2, Field3, Field4, Field5. > > Example of file: > "123","Anna","Manchester United","London, UK","" > "1234","Ann","Gas House Gorillas","New York, NY","" > "12345","Anna Maria","Brooklyn Dodgers","Brooklyn, NY","This is a really > long string" > "678901","Santa Anna","New York Rangers","New York City, NY","" > > * Notice some commas may appear INSIDE fields. > > I want my output array to basically have the maximum widths for each field. > I'm trying to build an import tool and this will help me when the provider > sends me data without field layouts. I figure I'll grab the line with FGetsEx > and then analyze each field from there. Off the top of my head I can create a > stub cursor with each field type being Memo, import the line read into that > cursor and then cycle through each and calculate the max via > LEN(ALLTRIM(Fieldn)), but that seems like an awfully big hammer (in other > words, it seems very 'kludgey'). > > Mind you, it's not ideal, but it's something to give me an idea of where my > truncations are occurring. I'm importing into a MySQL database and getting a > ton of truncations. I want to see where he's sending me something different > than officially expected. The SHOW WARNINGS command in MySQL isn't the > solution either. I just want to know what fields have longer data values than > he's declaring. > _______________________________________________ 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.

