Hi All,
I need some help/direction ... I am not proficient with XBASIC. Here is the problem: I have an equipment table for transformers etc. A record is created when the equipment is installed and when it is removed. There may be one (1) record or more than ten (10) records for each serial number. Each record contains a serial number (serialnum), date (eqpdate) etc. I have added a record type (rec_type) field. The idea is to flag each record for a serial number as "HISTORY" in the Rec_Type field except the latest record which will be flaged as "ACTIVE". This would allow for one to report on the history of a transformer or by using the "ACTIVE" record to know the current location of the equipment in question. This table has over 16000 records and I need to UPDATE THE rec_type field as "HISTORY" or "ACTIVE". Sure would hate to do this manually .....
The records are ordered by date (eqpdate). I think I would need to loop through the records grouped in serial number by date order. Then update (rec_type) as "HISTORY" except the last record for each serial number which would be updated as "ACTIVE". It might be easier to do an update to update all records as 'HISTORY" and then do a second update that would loop thru the records grouped in serial number in date order and somehow fetch the last record for each serial number and update it to "ACTIVE".
Any help would be greatly appreciated .....
Thanks,
Carl
I need some help/direction ... I am not proficient with XBASIC. Here is the problem: I have an equipment table for transformers etc. A record is created when the equipment is installed and when it is removed. There may be one (1) record or more than ten (10) records for each serial number. Each record contains a serial number (serialnum), date (eqpdate) etc. I have added a record type (rec_type) field. The idea is to flag each record for a serial number as "HISTORY" in the Rec_Type field except the latest record which will be flaged as "ACTIVE". This would allow for one to report on the history of a transformer or by using the "ACTIVE" record to know the current location of the equipment in question. This table has over 16000 records and I need to UPDATE THE rec_type field as "HISTORY" or "ACTIVE". Sure would hate to do this manually .....
The records are ordered by date (eqpdate). I think I would need to loop through the records grouped in serial number by date order. Then update (rec_type) as "HISTORY" except the last record for each serial number which would be updated as "ACTIVE". It might be easier to do an update to update all records as 'HISTORY" and then do a second update that would loop thru the records grouped in serial number in date order and somehow fetch the last record for each serial number and update it to "ACTIVE".
Any help would be greatly appreciated .....
Thanks,
Carl
Comment