Professional > Data management scripting > Merging case data > Running a vertical merge > Allocating Respondent.Serial in ranges
 
Allocating Respondent.Serial in ranges
This example makes use of the OnNextCase event section of a DMS script. The CurrentInputDataSource property of the dmgrJob object is used to identify the input data source. An offset value is then added to the original value of Respondent.Serial to create a number within a unique range for each input data source.
Event (OnNextCase, "Reallocate Respondent.Serial")

Dim myOffset

Select Case (dmgrJob.CurrentInputDataSource)
Case 0 ' Master data source
myOffset = 0
Case 1 ' Second input data source
myOffset = 10000
Case 2 ' Third input data source
myOffset = 20000
End Select

Respondent.Serial = Respondent.Serial + myOffset

End Event
This is a more succinct version of the same example:
Event (OnNextCase, "Reallocate Respondent.Serial")

Respondent.Serial = _
Respondent.Serial + _
(dmgrJob.CurrentInputDataSource * 10000)

End Event
For these examples to work, none of the cases in the input data sources should have a value of Respondent.Serial greater than 9999. If your input data files contain cases that have higher values than this, you must specify larger offset values.
See also
Running a vertical merge