In addition, I don't give fieldname specific name and instead used F1, F2... and so on to safe guard the database to users who might used excel to view or import the dbf and unknowingly corrupted it. Sometimes there users who are curious that constantly give headache.
So if they don't understand the contents and the relation of each dbf they would stop and just marvel. Besides 50% of a system is told by the database itself to the eyes of the programmer. This is how I put the tables and I believed is equally easy to convert to MySQL script or Oracle script.
Code: Select all
IF .NOT. FILE( "&ChartAcct" + ".DBF" )
DBCREATE( ( ChartAcct ),;
{ { "F1" , "C", 1, 0 } , ; // F/S Account Type Code
{ "F2" , "C", 3, 0 } , ; // Account Classification Code
{ "F3" , "C", 13, 0 } , ; // Account Number or Code
{ "F4" , "C",100, 0 } , ; // Description
{ "F5" , "C", 13, 0 } , ; // Parent Account Number or Code
{ "F6" , "N", 1, 0 } , ; // Level or Indention
{ "F7" , "L", 1, 0 } , ; // Account Status (.T. = Active, .F. = Inactive)
{ "F8" , "L", 1, 0 } , ; // Show as Attachment or Itemize (.T. = Attachment, .F. = Itemize)
{ "F9" , "D", 8, 0 } , ; // Date this Account Made Inactive
{ "F10" , "D", 8, 0 } , ; // Date this Account can be deleted
{ "F11" , "N", 13, 2 } , ; // TOTAL LY Month 1 (Last Year)
{ "F12" , "N", 13, 2 } , ; // TOTAL LY Month 2
{ "F13" , "N", 13, 2 } , ; // TOTAL LY Month 3
{ "F14" , "N", 13, 2 } , ; // TOTAL LY Month 4
{ "F15" , "N", 13, 2 } , ; // TOTAL LY Month 5
{ "F16" , "N", 13, 2 } , ; // TOTAL LY Month 6
{ "F17" , "N", 13, 2 } , ; // TOTAL LY Month 7
{ "F18" , "N", 13, 2 } , ; // TOTAL LY Month 8
{ "F19" , "N", 13, 2 } , ; // TOTAL LY Month 9
{ "F20" , "N", 13, 2 } , ; // TOTAL LY Month 10
{ "F21" , "N", 13, 2 } , ; // TOTAL LY Month 11
{ "F22" , "N", 13, 2 } , ; // TOTAL LY Month 12
{ "F23" , "N", 13, 2 } , ; // TOTAL TY Month 1 (This Year)
{ "F24" , "N", 13, 2 } , ; // TOTAL TY Month 2
{ "F25" , "N", 13, 2 } , ; // TOTAL TY Month 3
{ "F26" , "N", 13, 2 } , ; // TOTAL TY Month 4
{ "F27" , "N", 13, 2 } , ; // TOTAL TY Month 5
{ "F28" , "N", 13, 2 } , ; // TOTAL TY Month 6
{ "F29" , "N", 13, 2 } , ; // TOTAL TY Month 7
{ "F30" , "N", 13, 2 } , ; // TOTAL TY Month 8
{ "F31" , "N", 13, 2 } , ; // TOTAL TY Month 9
{ "F32" , "N", 13, 2 } , ; // TOTAL TY Month 10
{ "F33" , "N", 13, 2 } , ; // TOTAL TY Month 11
{ "F34" , "N", 13, 2 }}, ; // TOTAL TY Month 12
RDDSETDEFAULT() )
ENDIF
IF .NOT. FILE( "&ChartAcct" + ".CDX" )
IF .NOT. NETUSE( ( ChartAcct ), "CHARTACCT", Exclusive, ReadWrite )
cBreakMsg := "Cannot open file " + ChartAcct + " exclusively."
BREAK
ENDIF
INDEX ON F3 TAG AcctCode TO ( ChartAcct ) EVAL IndexStatBar( 1, "ACCTCODE" ) EVERY 1
INDEX ON F5 TAG Parent TO ( ChartAcct ) EVAL IndexStatBar( 2, "PARENT" ) EVERY 1
INDEX ON F1+F2+F3 TAG FSClass TO ( ChartAcct ) EVAL IndexStatBar( 3, "FSCLASS" ) EVERY 1
INDEX ON F1+F2+F4 TAG ByTitle TO ( ChartAcct ) EVAL IndexStatBar( 3, "BYTITLE" ) EVERY 1
INDEX ON F4 TAG FSName TO ( ChartAcct ) EVAL IndexStatBar( 4, "FSNAME" ) EVERY 1
ORDLISTADD( ( ChartAcct ) )
IF LASTREC() = 0
ScriptCoopTitle()
ENDIF
CHARTACCT->( DBCLOSEAREA() )
ENDIF