I am trying to change the structure of a table with Objectpal. Tony helped me greatly in this post:
but I can't figure out why the RIV:Field_struc is the perfect structure but it is not using that example to restructure the actual table. Code follows:
but I can't figure out why the RIV:Field_struc is the perfect structure but it is not using that example to restructure the actual table. Code follows:
Code:
status = " Restructuring source file"
Tbl.attach(sourcefile)
Tbl.enumFieldStruct( ":PRIV:field_struct.db" )
tcFlds.open(":PRIV:field_struct.db" )
tcFlds.edit()
scan tcFlds :
if tcFlds."Field Name" = "EXPIRYDATE" then
tcFlds."Type" = "DATE"
quitLoop
endif
endscan
scan tcFlds :
if tcFlds."Field Name" = "CANCELDATE" then
tcFlds."Type" = "DATE"
quitLoop
endif
endscan
scan tcFlds :
if tcFlds."Field Name" = "JOINDATE" then
tcFlds."Type" = "DATE"
quitLoop
endif
endscan
scan tcFlds :
if tcFlds."Field Name" = "DDSBEGIN" then
tcFlds."Type" = "DATE"
quitLoop
endif
endscan
scan tcFlds :
if tcFlds."Field Name" = "DDSEND" then
tcFlds."Type" = "DATE"
quitLoop
endif
endscan
scan tcFlds :
if tcFlds."Field Name" = "LASTUPDATEDDATE" then
tcFlds."Type" = "DATE"
quitLoop
endif
endscan
scan tcFlds :
if tcFlds."Field Name" = "ADDRESS3" then
tcFlds."Type" = "ALPHA"
tcFlds."Size" = 30
quitLoop
endif
endscan
scan tcFlds :
if tcFlds."Field Name" = "DDSRATE" then
tcFlds."Type" = "$"
quitLoop
endif
endscan
scan tcFlds :
if tcFlds."Field Name" = "MISC" then
tcFlds."Type" = "ALPHA"
tcFlds."Size" = 30
quitLoop
endif
endscan
tcFlds.endEdit()
tcFlds.close()
dynNewStru["FIELDSTRUCT"] = ":PRIV:field_struct.db"
Tbl.restructure(dynNewStru)