I am using a function to add fields to a table and I have been doing it this way for years without any problems but now I am trying to add fields to a table and it is blowing the table up deleting at least one field and changing field types on others.
I will post the function code here but first I am trying to get a list of the fields in the table using A5_GET_FIELDNAMES() and then write it somewhere like a txt file so I can post the results here and also use it to check for problems.
So if I use fld_list = a5_get_fieldnames( "wo_header.dbf" ) it puts the fields in a list.
I think if I tried
It would write all the field names to one line. I am going to try that and see.
Here the function I am using to add the fields to the table.
I will post the function code here but first I am trying to get a list of the fields in the table using A5_GET_FIELDNAMES() and then write it somewhere like a txt file so I can post the results here and also use it to check for problems.
So if I use fld_list = a5_get_fieldnames( "wo_header.dbf" ) it puts the fields in a list.
I think if I tried
Code:
fld_list = a5_get_fieldnames( "wo_header.dbf" ) f=file.create("Filename",file_rw_exclusive) f.write_line(fld_list) f.flush() f.close()
Here the function I am using to add the fields to the table.
Code:
FUNCTION wo_header AS L ( ) DIM datapath as C IF a5.Get_Master_Path() = "" datapath = a5.Get_Path()+chr(92) ELSE datapath = a5.Get_Master_Path()+chr(92) END IF 'Check table and LAST field updated first. If it has already been 'done, skip the rest. Don't need to use "datapath" to get field names. fld_list = a5_get_fieldnames( "wo_header.dbf" ) IF "IS_Exported"$fld_list '2013-12-13 GOTO Updates_done END if fld_list = a5_get_fieldnames( "wo_header.dbf" ) IF .not. ("Is_Exported"$fld_list) new_flds = <<%list% Is_Exported,L,1,0 event_id,N,16,0 Details,C,72,0 tmstart,T,17,0 tmend,T,17,0 Alarm,C,20,0 How,C,20,0 Equip,C,20,0 Export_It,L,1,0 Add_Date,D,8,0 Notes,M,10,0 Priority,N,4,0 Class_type,C,16,0 Rev_Date,D,8,0 Sch_datec,C,16,0 Sch_Date,D,8,0 Cust_email,C,60,0 %list% a5_add_fields_to_table( datapath + "wo_header.dbf", new_flds ) end if Updates_done: END FUNCTION
Comment