Tips when developing Script Expressions
Here are some general guide lines that will make your development of scripts faster and more stable.
Read this guide on Script Expressions to start with:
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 trackPoint 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.
App Console: http://gpsgate.com/blogComment/app_console
How to use SimOne to test Event Rules http://forum.gpsgate.com/topic.asp?TOPIC_ID=14038
Export the Event Rule from the test application and import it into the customer application when you are finished with development and testing.
How to: http://gpsgate.com/blogComment/export_and_import_event_rules_and_geofences
Here is a list of script samples (we will add more over time):
Sample: Inside POI http://forum.gpsgate.com/topic.asp?TOPIC_ID=18314
Sample: Geofence rule that checks if a vehicle is inside a geofence named by a custom field.
Sample: Script Expression example for daily odometer interval.
Guide: Multiple events per event rule and device. Set Notifier variables from script.
Guide: Allow users to select Event Rules using Custom Fields with scripting
Guide: Notifier variables: http://forum.gpsgate.com/topic.asp?TOPIC_ID=18301
Guide: Trip and Idle in Event Rule Reports
Guide: Driver Login Report http://gpsgate.com/blogComment/999
Sample: 5 km gap without position updates http://forum.gpsgate.com/topic.asp?TOPIC_ID=18335
Sample: Distance between POIs (customer sites) http://forum.gpsgate.com/topic.asp?TOPIC_ID=18588
Sample: Create fatigue alerts with scripting http://gpsgate.com/blogComment/fatigue_script