Script Expressions: development tips

These general guidelines will make your scripts development faster and more stable.

General tips

  • Write down all Use Cases you want your script to support. Write down each case step by step. Once you have developed your script, make sure you test all Use Cases.
  • Create a test application. Always make your development in a separate test application and not in the customer application. The test application can also be on a different server.
  • Use the Test Script function you have in the editor to test your script. You can set variable and track point inputs in the editor. Geofences, POIs Custom Fields etc. will be taken from the selected user.
  • Use the log() function to log to the Terminal or the App Console.

Script Samples

  • Inside POI (link)
  • Geofence rule that checks if a vehicle is inside a geofence named by a custom field. (link).
  • Script Expression example for daily odometer interval. (link)
  • Multiple events per event rule and device. Set Notifier variables from script. (link)
  • Trip & Idle scripted report. (link)
  • 5 km gap without position updates. (link)
  • Distance between POIs (customer sites). (link).
  • Create fatigue alerts with scripting. (link).

Other resources

  • Guide: Allow users to select Event Rules using Custom Fields with scripting. (link)
  • Guide: Notifier variables. (link)
  • Guide: Driver Login Report. (link)

Testing recommendations