join
void dataSet.join ( DataSet dataSet )
Description
Merge data records from two data sets.
Parameters
- dataSet Data set whose records are to be merged.
Return Values
Returns void.
Change Log
Version | Description |
---|---|
5.0 | Added for all editions. |
Examples
Merge DataRecords from DataSets
// Create dataSet
DataSet dataSet = new DataSet();
// Load dataSet with information
for (i = 0; i < 3; ++i)
{
DataRecord record = new DataRecord();
record.put("DATA_SET_ONE", i);
dataSet.addDataRecord(record);
}
// Create another dataSet
DataSet anotherDataSet = new DataSet();
// Load dataSet with information
for (i = 0; i < 2; ++i)
{
DataRecord record = new DataRecord();
record.put("DATA_SET_TWO", i);
anotherDataSet.addDataRecord(record);
}
// Join DataSets
dataSet.join(anotherDataSet);
// Write merged DataSet to Log (in dataRecords)
for (i = 0; i < dataSet.getNumDataRecords(); ++i)
{
DataRecord record = dataSet.getDataRecord(i);
session.log("DataRecord " + i + ": " + record.toString());
}
// Log Output:
// DataRecord 0: {DATA_SET_TWO=0, DATA_SET_ONE=0}
// DataRecord 1: {DATA_SET_TWO=1, DATA_SET_ONE=1}
// DataRecord 2: {DATA_SET_ONE=2}
DataSet dataSet = new DataSet();
// Load dataSet with information
for (i = 0; i < 3; ++i)
{
DataRecord record = new DataRecord();
record.put("DATA_SET_ONE", i);
dataSet.addDataRecord(record);
}
// Create another dataSet
DataSet anotherDataSet = new DataSet();
// Load dataSet with information
for (i = 0; i < 2; ++i)
{
DataRecord record = new DataRecord();
record.put("DATA_SET_TWO", i);
anotherDataSet.addDataRecord(record);
}
// Join DataSets
dataSet.join(anotherDataSet);
// Write merged DataSet to Log (in dataRecords)
for (i = 0; i < dataSet.getNumDataRecords(); ++i)
{
DataRecord record = dataSet.getDataRecord(i);
session.log("DataRecord " + i + ": " + record.toString());
}
// Log Output:
// DataRecord 0: {DATA_SET_TWO=0, DATA_SET_ONE=0}
// DataRecord 1: {DATA_SET_TWO=1, DATA_SET_ONE=1}
// DataRecord 2: {DATA_SET_ONE=2}
scraper on 07/16/2010 at 5:19 pm
- Printer-friendly version
- Login or register to post comments