CurrentDirectDistance() can only be used in a Match record action: in its Match condition, Rating formula or Threashold - to get the direct distance between the action's base record and the current match candidate (when used in the Rating formula) or the matched record (when used in Match actions).

The function works exactly like the DirectDistance() function with the only exception that it always calculates the distance between the base record's location and the matching/matched record's location, so it doesn't accept coordinates in its input.

If you need to get the distance or time from the matching record's location to the base record's location, use the Route() function to pass the coordinates explicitly.

Note. Unlike CurrentRoute(), CurrentDirectDistance() can also be used in the Match record's Match condition.

How to use

In a Twig field:

  • CurrentCurrentRoute()

In the Expression builder of a Match record's Match condition, select Current direct distance in the Special block:

Input

None.

Output

See Output of the DirectDistance() function.

Example

  • -CurrentDirectDistance() - in the Match record's Rating formula (with the minus sign at the start!) to find the closest record to the base location by the direct distance

  • This Match condition in a Match record action will produce match candidates within the 32 miles/kilometers from the base record's location:

See also

Did this answer your question?