We use a script to move data from an older version of our application to a newer one. The script is in the new one. The following is the script for one data file. We have about 60 DBF's
'ACCOUNT
'-----------------------------
response = ui_msg_box("Update","Update Account Codes ?",51)
If response = 6 Then
filename = DDIR + "\account.dbf"
result = file.exists(filename)
IF result = .F. THEN
answer = ui_msg_box("","ACCOUNT.DBF File does not exist", UI_OK+UI_STOP_SYMBOL)
ELSE
a_tbl = table.open( "account.dbf")
a_tbl.zap( .T. )
append.t_db = DDIR + "account.dbf"
append.m_key = ""
append.t_key = ""
append.m_filter = ""
append.t_filter = ""
append.type = "All"
append.m_count = 2
append.m_field1 = "ACCOUNT"
append.m_exp1 = "@ACCOUNT->ACCOUNT"
append.m_field2 = "DESCRIPT"
append.m_exp2 = "@ACCOUNT->DESCRIPT"
append.t_count = 0
a_tbl.append()
a_tbl.close()
answer = ui_msg_box("","ACCOUNT.DBF Updated", UI_OK)
END IF
END IF
**************************************************
Both versions have identical structures but the fields are in a different order.
In old version, account.dbf
1.account C10
2.description C20
In NEW version, account.dbf
1.description C20
2.account C10.
We have noticed that data in larger DBF's appear to be going into the wrong field. Dates going into a character field. On some testing, it looks like both files MUST have the same order of fields.
Opinions? Or what mite be causing this.
Thanks.
DeWayne
'ACCOUNT
'-----------------------------
response = ui_msg_box("Update","Update Account Codes ?",51)
If response = 6 Then
filename = DDIR + "\account.dbf"
result = file.exists(filename)
IF result = .F. THEN
answer = ui_msg_box("","ACCOUNT.DBF File does not exist", UI_OK+UI_STOP_SYMBOL)
ELSE
a_tbl = table.open( "account.dbf")
a_tbl.zap( .T. )
append.t_db = DDIR + "account.dbf"
append.m_key = ""
append.t_key = ""
append.m_filter = ""
append.t_filter = ""
append.type = "All"
append.m_count = 2
append.m_field1 = "ACCOUNT"
append.m_exp1 = "@ACCOUNT->ACCOUNT"
append.m_field2 = "DESCRIPT"
append.m_exp2 = "@ACCOUNT->DESCRIPT"
append.t_count = 0
a_tbl.append()
a_tbl.close()
answer = ui_msg_box("","ACCOUNT.DBF Updated", UI_OK)
END IF
END IF
**************************************************
Both versions have identical structures but the fields are in a different order.
In old version, account.dbf
1.account C10
2.description C20
In NEW version, account.dbf
1.description C20
2.account C10.
We have noticed that data in larger DBF's appear to be going into the wrong field. Dates going into a character field. On some testing, it looks like both files MUST have the same order of fields.
Opinions? Or what mite be causing this.
Thanks.
DeWayne
Comment