Hello @116dreamer ,
Thanks for the details.
As per my discussion with internal team, the bounding ranges (aka wiggle) must be constants, i.e. known at compile time. What that mean is that if the desired wiggle is dynamic (that is dependent on the event data, as in your example) there are couple of ways to address this.
- Use the maximum wiggle specified in the join DATEDIFF and put additional logic for the dynamic behavior using CASE into the WHERE clause (or even leave it in the ON, but in addition to the constant wiggle).
- When there is a small known set of various wiggles, like it seems to be the case here. It may be beneficial to just write them as separate joins and union results together. In the above example you would create separate steps - S1: filtering on tcam...Cycle = 8 and S2: filtering on tcam...Cycle <> 8, then do separate join using S1 in one case and S2 in another, each with it's own wiggle and then union the results.
Hope this helps.