Desktop User Guides > Professional > Data management scripting > Merging case data > Running a vertical merge > Creating new values for Respondent.Serial
 
Creating new values for Respondent.Serial
This example makes use of both the Metadata section and the OnNextCase event section of a DMS script.
Two new variables are defined in the Metadata section to store the original value of Respondent.Serial and the name of the office that collected the input data.
In the OnNextCase event section, the original value of Respondent.Serial is assigned to the first new variable, and the OutputCaseNumber property of the dmgrJob object is used to create a new a value for Respondent.Serial. The CurrentInputDataSource property of the dmgrJob object identifies the input data source, and the relevant office name is stored in the second new variable.
Metadata (ENU, Question, Label, myMasterDataSource)

     OriginalRespondentSerial long;
     OriginatingOffice text [10];

End Metadata

Event (OnNextCase, "Create new Respondent.Serial")

     OriginalRespondentSerial = Respondent.Serial
     Respondent.Serial = dmgrJob.OutputCaseNumber

     Select Case (dmgrJob.CurrentInputDataSource)
          Case 0 ' Master data source
               OriginatingOffice = "Paris"
          Case 1 ' Second input data source
               OriginatingOffice = "London"
          Case 2 ' Third input data source
               OriginatingOffice = "Berlin"
     End Select
End Event
Of course, you could store other information about the input data source if you wanted to, such as the name of the input file.
See
Running a vertical merge