If you are thinking of deleting a datafile attribute from Asset Control, here are a few things to consider:
- Metadata about datafile attributes is stored in the database table datafile_attributes and each of them is assigned a numerical ID in the column attr_num (DATE is 0, TIME is 1 etc.).
- This attr_num sequence cannot have gaps. E.g. I have seen the AC Desktop not load and display its modules if there was a gap in datafile_attributes.attr_num.
- You cannot delete an attribute from datafile_attributes and then close the gap by reassigning attr_num. See the next point to understand why.
- Timeseries is stored in datafiles in binary format. References to datafile attributes are made using their attr_num not their attr_tag (i.e. 0, not DATE). If you were to reassign attr_num, you would leave behind corrupted datafiles.
So, if you cannot delete them, what can you do with datafile attributes that you no longer need?
One common approach is to change their attr_tag, e.g. from C0#TS200 to deprecated_C0#TS200 etc. This leaves no gaps in the attr_num sequence and datafiles are not corrupted while making clear they are no longer to be used.
acdba@acbox:~$ echo -e "TRANS\nSQL update datafile_attributes set attr_tag = 'deprecated_C0#TS200' where attr_tag = 'C0#TS200'" | ac_bl -
+++INFO+++ 20190323_14:23:13 @(#)ac_bl[7.3/$Revision: 47831 $]: Number of delivered transactions: 1 (1 successful)
I also want to mention a situation where deleting datafile attributes is possible:
- You are in development and are working on a new interface.
- The datafile attributes for this new interface occupy the highest attr_num values in the datafile_attributes table, i.e. there are no other datafile attributes with an attr_num higher than the ones of the interface in question.
- If you delete the datafile attributes of this interface and - if you have them - any datafile that would have referenced any of these datafile attributes, you are safe.
If in doubt, follow the renaming approach from above.