User avatar
johan
GpsGate
Posts: 14440
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

SCRIPT: Inside POI

Wed Sep 09, 2015 6:33 pm

SCRIPT: Inside POI

This guide shows how you can write a inside POI rule that using a script rather than the POI expression. The advantage with using a script is that it is easy to extend the functionallity.

Test Setup

Tips when developing Script Expressions.
topic.asp?TOPIC_ID=18303

Create Event Rule

Create an Event Rule with a Script Expression like the one below:

Code: Select all

// Replace MyCategory with a POI category you have created in your test application.
var pois = poi.find(trackPoint.position.longitude, trackPoint.position.latitude, 500, 'MyCategory')

if(pois.length > 0)
  context.setVariable('POI_NAME', pois[0].name);
else
  context.setVariable('POI_NAME', '-');

// Return true if inside POI.
return pois.length != 0;
Notifiers

Use the function context.setVariable() to create variables you can use in the Notifiers. For example a "Report Argument" if you want to create a column in the EV1000 report. Or an "Argument" notifier if you want to create on column in the Event window in the Workspace.

In the example above, the named POI will be in variable [POI_NAME]

Related topics

More info on Script Expressions here:
http://gpsgate.com/blogComment/script_expressions

Allow users to select Event Rules using Custom Fields with scripting
http://gpsgate.com/blogComment/allow_us ... _scripting

Displaying arguments on Event Rule reports
http://gpsgate.com/blogComment/displayi ... le_reports


Regards,
Johan

GpsGate Support

Return to “GpsGate for Developers”