Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: yifengHi,
I have tried to use the TimeSubtract function in the XRef. My scenario is compare 2 sets of data by A number, B number and the StartTime. Using the XRef to match A and B number then subtract the StartTime from 1st set of record to the 2nd to give me a time different (in seconds). The records i want to included in the matched output is the records with time different less than 10.
The script i've put in XRef only did the comparison on exact matches. Please see below. Can you tell me what i've done wrong? Thank you.
Left Input
OPTUS_INPUT_a_number, OPTUS_INPUT_b_number,
OPTUS_INPUT_call_start_date, OPTUS_INPUT_call_start_time
Right Input
TELSTRA_INPUT_Aparty, TELSTRA_INPUT_Bparty,
TELSTRA_INPUT_CallDate, TELSTRA_INPUT_CallTime
Script
output 1 {
emit 1:*
where join.leftOrphan
}
output 2 {
emit *
emit timeSubtract(OPTUS_INPUT_call_start_time, TELSTRA_INPUT_CallTime,"seconds") as TimeDiff
where join.match
and timeSubtract(OPTUS_INPUT_call_start_time, TELSTRA_INPUT_CallTime,"seconds") <= {{^buffer^}}
}
output 3 {
emit 2:*
where join.rightOrphan
}