How can I compare the value of [_thisrow] with the whole list?

FEI
Bronze 2
Bronze 2

When adding a new record, I need to fill in the [start time] and [end time]. I hope that the new data does not have overlapping times.

For example, if the data already includes:
1.[start time] 9:30:00, [end time] 10:30:00
2.[start time] 11:50:00, [end time] 12:50:00
Then, the following time periods cannot be added:
9:30-10:30
11:50-12:50

For example, 10:40-11:40 would return true.

0 2 32
2 REPLIES 2

One approach...

You can get the min start time by MIN(table[start time]) and the max end time by max(table[end time]).

Then combining IF, AND, OR, comparison operators, build an expression to check if a new start and end time interval does not fall within the existing min start time and max end time. (of course [start time] must be smaller than [end time] also..)

The current column value can be obtained by [_THIS].

You need to also consider the condition for the very first record. This can be checked by COUNT(table[ID]) > 0.

Thank you very much for your reply๏ผŒI've done it this way.

OR(

AND(
[_THISROW].[start time]>=
MAX(
SELECT(Meeting[end time],
[end time]=<[_THISROW].[end time],
)),
[_THISROW].[end time]<=
MIN(
SELECT(Meeting[start time],
[start time]>=[_THISROW].[start time],
))),

AND(
[_THISROW].[start time]>=
MAX(
SELECT(Meeting[end time],
[_THISROW].[end time]>[_THISROW].[start time])

,
AND(
[_THISROW].[end time]<=
MIN(
SELECT(Meeting[start time],
[_THISROW].[start time]<[_THISROW].[end time])

)

Top Labels in this Space