Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restructure problems

Status
Not open for further replies.

soks2626

Programmer
Jul 3, 2002
22
US
I'm trying to restructure a table via a script but I keep getting errors that don't allow me to restructure the table. Any help would be great. The code's attached here. Thanks1

-Alex

var
tc tcursor
tbl Table
tcFlds TCursor
dynNewStru DynArray[] Anytype
endvar

tbl.attach( ":ORDER:ORDER.DB" )
tbl.enumFieldStruct( ":ORDER:field_struct.db" )

tcFlds.open(":ORDER:field_struct.db" )
tcFlds.edit()
tcFlds.end()
tcFlds.insertAfterRecord()
tcFlds."Field Name" = "Data Entry Error" ;field name
tcFlds."Type" = "ALPHA" ;field type
tcFlds."Size" = 1
tcFlds."_Invariant Field Id" = restructureAdd
tcFlds.endEdit()
tcFlds.close()

dynNewStru["FIELDSTRUCT"] = ":ORDER:field_struct.db"
if tbl.restructure( dynNewStru ) then
msginfo("Success", "ORDER.DB update complete.")
delete(":ORDER:field_struct.db")
else
msgstop("Error", "Son of a gun.")
return
endif
 
Delete
tcFlds."_Invariant Field Id" = restructureAdd

and it should work fine.
 
Now I get "invalid array of validity check desciptors". Any ideas?
 
After tcFlds."Size" = 1, add:
tcFlds."Dec" = 0

Also change tcFlds."_Invariant Field Id" = restructureAdd to:
tcFlds.postRecord()
tcFlds."_Invariant Field Id" = tcFlds.nRecords()

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top