This can give an idea how you could do this with scripting:
Names Default To Here(1);
dt1 = New Table("Table A",
Add Rows(4),
Compress File When Saved(1),
New Column("Start",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([1, 5, 10, 15])
),
New Column("End",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([5, 10, 15, 20])
),
New Column("Name", Character, "Nominal", Set Values({"A", "B", "C", "D"}))
);
dt2 = New Table("Table B",
Add Rows(5),
Compress File When Saved(1),
New Column("Start",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([1, 4, 8, 12, 16])
),
New Column("End",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([4, 8, 12, 16, 20])
),
New Column("Name",
Character,
"Nominal",
Set Values({"X1", "X2", "X3", "X4", "X5"})
)
);
//create collection table
dt_final = New Table("Table A-B",
Compress File When Saved(1),
New Column("Start", Numeric, "Continuous", Format("Best", 12)),
New Column("End", Numeric, "Continuous", Format("Best", 12)),
New Column("Name", Character, "Nominal")
);
For Each Row(dt1,
startVal = Column(dt1, "Start")[Row()];
endVal = Column(dt1, "End")[Row()];
nameVal = Column(dt1, "Name")[Row()];
r_dt2 = dt2 << get rows where(startVal <= :Start <= endVal | startVal <= :End <= endVal);
For(i = 1, i <= N Items(r_dt2), i++,
newEnd = Min(Column(dt2, "End")[r_dt2[i]], endVal);
newName = nameVal || " " ||Column(dt2, "Name")[r_dt2[i]];
newRow = EvalList({startVal, newEnd, newName});
dt_final << Add rows({Start = newRow[1], End = newRow[2], Name = newRow[3]});
startVal = newEnd;
endVal= Max(Column(dt2, "End")[r_dt2[i]], endVal);
);
);
Close(dt1, no save);
Close(dt2, no save);
-Jarmo