We have a Record Type that is likely to run past it's available numbers before the end of the year. I know I can add an extra zero, but is there a way that I can update the existing records to include the extra zero in the Expanded Number field?
Numbering pattern is YYYY/GGGGG and we're currently at 2012/88016. We have roughly 10,000 records added each month using this record type. I'm going to change the numbering to YYYY/GGGGGG (adding one extra G), but this will only add the additional 0 prefix to newly created records and not the pre existing records. Given that the Expanded Number field is used as the Unique Identifier for updating records via an import, I'm stumped as to how I can update this field. Does anyone know if it is possible and if so how it can be achieved?
Create a new excel workbook. Press Alt+F11, add a reference to the TRIMSDK (tools->references), create a new module, paste in this code, and then execute. Change the record type to match whatever you're doing. Run in dev/test first, as always! Note that if the record won't save for any reason then the number won't be updated (like missing container, conflicting dates, etc).
---- VBA Code -----
'' assume record type is "Document" '' assume pattern used to be "KKK/GGGGG", needs to have an extra 0
Dim tDatabase As TRIMSDK.Database Dim tDatabases As New TRIMSDK.Databases Set tDatabase = tDatabases.ChooseOneUI(0)
Dim tRecordSearch As TRIMSDK.RecordSearch Set tRecordSearch = tDatabase.NewRecordSearch tRecordSearch.AddRecordNumberClause "?*" tRecordSearch.FilterClear sfRecordType tRecordSearch.FilterRecordType tDatabase.GetRecordType("Document") Dim tRecords As TRIMSDK.Records Set tRecords = tRecordSearch.GetRecords Dim tRecord As TRIMSDK.Record Set tRecord = tRecords.Next Do While (Not tRecord Is Nothing) On Error Resume Next tRecord.LongNumber = Replace(tRecord.LongNumber, "/", "/0") tRecord.Save Set tRecord = tRecords.Next Loop End Sub