Hello and thank you for reaching out to us with your question.
Below the specifications you asked:
Since version 8.0 there is a new syntax for redefining Register definitions.
Until version 8.0
Previously you would have to Include full register definition, add new fields to record header, new fields to a matrix, add new indexes to the record.
On version update, you had to compare old definition with the new one, put the custom fields in the correct place (end of definition). Then you had to write and import function that would link all the values from the old data structure to the new one.
Version 8.0 and up
New primitives are introduced: RecordAddBegin and EndRecordAdd.
Between these two primitives, you define the new fields/indexes just like you used to do before.
For example:
RecordAddBegin(CUVc,"CUVc_Custom");
RecordField(CustomStr,M4Str,255,0);
RecordField(CustomInt,M4Int,0,0);
ArrayField(CustArrStr,M4Str,255,0);
ArrayField(CustArrInt,M4Int,0,0);
ChangeField(Code,M4Code,30,0);
ChangeField(Name,M4UStr,100,0);
ChangeMatrixField(CustCode,M4Code,30,INVc);
DisableIndex("Name");
KeyBegin(NewKey);
KeySegment(CustomStr);
KeySegment(Code);
SubSetKeyBegin2(CustArrStr);
AppendMatrixFieldToKeyName(CustArrStr,0);
KeySegment(Code);
EndRecordAdd;
Version update:
On next version update, you don't have to do anything. Even if the register has new fields, it will do export/import correctly and link all the fields as necessary. So no need to compare register definitions and no need for import functions anymore.
Important:
- RecordAddBegin has a second parameter - import tag, which is mandatory to have. It works the same way as for RecordBegin primitive.
Restrictions:
- You won't be able to put existing registers' full definitions anymore. This will cause hal compiler error.
Limitations (at the moment):
- Not possible to Segments to existing indexes.