Posts

Showing posts from May, 2012

FoxPro Tips (1): Use Excel to Write Your Codes

Image
Figure 1 : File Layout for a Source Text File Do you ever think of using Excel or other spreadsheet application to help you to write your FoxPro program? Yes, when you need to write a set of tedious coding, you may find out Excel may be a great helper to you. For example, in order to convert a source text file into DBF format, I need to create a table structure based on the file layout of the text file (just like Figure 1). However, the problem is the text file consists of 200+ fields - I would definitely look stupid if I copy the field names & field properties one-by-one into the SQL coding. Your guess is right, I completed the relevant coding ( CREATE TABLE (Field1 C(1),Field2 C(8),...) ) within a few minutes by using Excel. Let me share with you how I did the coding: STEP 1:   Copy the file layout to Excel Figure 2: Copy file layout to Excel I copied field name, field type and field width from file layout Word document and pasted value into Excel. Of cou...