TMinIfID()

TMinIfID(a;b;c;d) has the same functionality like TMinIf(), but returns the minimum ID of the results with ID a to b, which is greater than or equal to c but less than or equal to d.