From wiki.ginstr.com
Jump to: navigation, search
(Calculate driving distance and store result into rows)
 
(30 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
;Description: Action is used to calculate driving distance between two GPS coordinates and store the result into target
 
;Description: Action is used to calculate driving distance between two GPS coordinates and store the result into target
 
:In order for this action to work, an internet connection must be active because the calculations are done by OSRM server.
 
:In order for this action to work, an internet connection must be active because the calculations are done by OSRM server.
 +
:In case there is no internet connection, <code>[[target|targetColumnNameOrWidgetIdNumber]]</code> and <code>[[target|targetColumnNameOrWidgetIdText]]</code> will not be updated.
  
 
;Action returns: void
 
;Action returns: void
 
==Action signatures==
 
==Action signatures==
  
===Calculate driving distance===
+
===Full signature (M103.8.0.5)===
 
+
:;<code>[gn:act_calculateDrivingDistance]|[targetRows,targetColumnNameOrWidgetIdNumber,targetColumnNameOrWidgetIdText,targetTextSuffix,callbackWidgetWhenDistanceReceived,callbackWidgetActionSet,targetIdColumnNameOrWidgetIdTextNumberFormat,callbackWidgetWhenAllDone,callbackWidgetWhenAllDoneActionSet;gpsPointsDataBlock{n}]</code>
:;<code>[gn:act_calculateDrivingDistance]|[target,source1,source2]</code>
 
  
 
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
Line 18: Line 18:
 
! scope="col" | Description
 
! scope="col" | Description
 
|-
 
|-
| <code>[[target]]</code>
+
| <code>[[target|targetRows]]</code>
| [[target]] into which calculated driving distance will be stored
+
| [[target]] target rows which can be used as source for calculating distance and target for storing calculated distance
 +
* Valid [[target|targets]]:
 +
:*<code>[[Datatypes#rows|row]]</code>
 +
|-
 +
| <code>[[target|targetColumnNameOrWidgetIdNumber]]</code>
 +
| [[target]] column in row or widget into which calculated distance will be stored
 +
* Valid [[target|targets]]:
 +
:*<code>rowColumnId</code> id of column in case we want to store into row, column must be of type [[Datatypes#number|number]]
 +
:*<code>widgetId</code> id of widget, widget must support and be of type [[Datatypes#number|number]]
 +
|-
 +
| <code>[[target|targetColumnNameOrWidgetIdText]]</code>
 +
| [[target]] column in row or widget into which calculated distance will be stored as text. <code>targetTextSuffix</code> will be appended as suffix to the value
 
* Valid [[target|targets]]:
 
* Valid [[target|targets]]:
:*<code>[[Datatypes#number|number]]</code>
+
:*<code>rowColumnId</code> id of column in case we want to store into row, column must be of type [[Datatypes#text|text]]
 +
:*<code>widgetId</code> id of widget, widget must support and be of type [[Datatypes#text|text]]
 
|-
 
|-
| <code>[[source|source1]]</code>
+
| <code>[[source|targetTextSuffix]]</code>
| [[source]] from where [[Datatypes#gps|gps]] coordinate will be used for calculation
+
| [[source]] suffix which will be added to <code>targetColumnNameOrWidgetIdText</code>
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
:*<code>[[Datatypes#gps|gps]]</code>
+
:*<code>[[Datatypes#text|text]]</code>
 
|-
 
|-
| <code>[[source|source2]]</code>
+
| <code>callbackWidgetWhenDistanceReceived</code>
| [[source]] from where [[Datatypes#gps|gps]] coordinate will be used for calculation
+
| [[target]] on which is defined <code>callbackWidgetActionSet</code>
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
:*<code>[[Datatypes#gps|gps]]</code>
+
:*<code>widgetId</code>
 
|-
 
|-
|}
+
| <code>callbackWidgetActionSet</code>
 
+
| [[:Category:Events|event]] action set name which will be fired after distance is calculated and stored
====Example====
+
* Valid [[source|sources]]:
:<code>@+id/deviceKm</code> - target<br>
+
:*<code>hardcoded</code>
:<code>@+id/gpsInput</code> - source1<br>
 
:<code>@+id/deviceGps</code> - source2<br>
 
:; ⤷ <code>[gn:act_calculateDrivingDistance]|[@+id/deviceKm,@+id/gpsInput,@+id/deviceGps]</code>
 
<hr>
 
 
 
===Calculate driving distance with callback action===
 
 
 
:;<code>[gn:act_calculateDrivingDistance]|[target,source1,source2;;eventWidgetId,event]</code>
 
 
 
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
 
|-
 
|-
! scope="col" | Parameter
+
| <code>targetIdColumnNameOrWidgetIdTextNumberFormat (optional)</code>
! scope="col" | Description
+
| number formatting for <code>targetColumnNameOrWidgetIdText</code> parameter. Default format <code>0.00</code> For valid formats see [https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html Formats]
|-
 
| <code>[[target]]</code>
 
| [[target]] into which calculated driving distance will be stored
 
* Valid [[target|targets]]:
 
:*<code>[[Datatypes#number|number]]</code>
 
|-
 
| <code>[[source|source1]]</code>
 
| [[source]] from where [[Datatypes#gps|gps]] coordinate will be used for calculation
 
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
:*<code>[[Datatypes#gps|gps]]</code>
+
:*<code>[[Datatypes#text|text]]</code>
 
|-
 
|-
| <code>[[source|source2]]</code>
+
| <code>gpsPointsDataBlock{n}</code>
| [[source]] from where [[Datatypes#gps|gps]] coordinate will be used for calculation
+
| [[source|sources]] which will be included into calculation
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
:*<code>[[Datatypes#gps|gps]]</code>
+
:*<code>[[Datatypes#gps|gps]]</code> widgets and/or column id's in case <code>targetRows</code> is defined
 
|-
 
|-
| <code>[[source|eventWidgetId]]</code>
+
| <code>callbackWidgetWhenAllDone</code>
| [[target]] on which defined <code>event</code> will be executed
+
| [[target]] on which is defined <code>callbackWidgetWhenAllDoneActionSet</code>
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
:*<code>[[Datatypes#number|number]]</code>
+
:*<code>widgetId</code>
 
|-
 
|-
| <code>[[:Category:Events|event]]</code>
+
| <code>callbackWidgetWhenAllDoneActionSet</code>
| [[:Category:Events|event]] which will be fired after action is executed
+
| [[:Category:Events|event]] action set name which will be fired after all distances are calculated and stored
 
* Valid [[source|sources]]:
 
* Valid [[source|sources]]:
 
:*<code>hardcoded</code>
 
:*<code>hardcoded</code>
|-
 
 
|}
 
|}
 +
 +
===Calculate driving distance (M103.8.0.5)===
 +
 +
:;<code>[gn:act_calculateDrivingDistance]|[,targetColumnNameOrWidgetIdNumber;gpsPoint1,gpsPoint2]</code>
  
 
====Example====
 
====Example====
:<code>@+id/deviceKm</code> - target<br>
+
:<code>@+id/calculateDrivingDistance_calculateDrivingDistance_result</code> - targetColumnNameOrWidgetIdNumber<br>
:<code>@+id/gpsInput</code> - source1<br>
+
:<code>@+id/calculateDrivingDistance_calculateDrivingDistance_pointOne</code> - gpsPoint1<br>
:<code>@+id/deviceGps</code> - source2<br>
+
:<code>@+id/calculateDrivingDistance_calculateDrivingDistance_pointTwo</code> - gpsPoint2<br>
:<code>@+id/onDistanceReceive</code> - callback widget<br>
+
:<code>@+id/calculateDrivingDistance_calculateDrivingDistance_pointThree</code> - gpsPoint3<br>
:<code>gn:act_set</code> - callback action<br>
+
:<code>@+id/calculateDrivingDistance_calculateDrivingDistance_pointFour</code> - gpsPoint4<br>
:; ⤷ <code>[gn:act_calculateDrivingDistance]|[@+id/deviceKm,@+id/gpsInput,@+id/deviceGps;;@+id/onDistanceReceive,gn:act_set]</code>
+
:; ⤷ [gn:act_calculateDrivingDistance]|[,@+id/calculateDrivingDistance_calculateDrivingDistance_result;@variable/calculateDrivingDistance_calculateDrivingDistance_pointOne,@variable/calculateDrivingDistance_calculateDrivingDistance_pointTwo,@variable/calculateDrivingDistance_calculateDrivingDistance_pointThree,@variable/calculateDrivingDistance_calculateDrivingDistance_pointFour]</code>
 
<hr>
 
<hr>
  
===Calculate driving distance and store result into [[Datatypes#rows|rows]]===
+
===Calculate driving distance with callback action (M103.8.0.5)===
 +
 
 +
:;<code>[gn:act_calculateDrivingDistance]|[,targetColumnNameOrWidgetIdNumber,,,callbackWidgetWhenDistanceReceived,callbackWidgetActionSet;gpsPoint1,gpsPoint2]</code>
  
:;<code>[gn:act_calculateDrivingDistance]|[rowsTarget,sourceColumnName,source;targetColumnName]</code>
+
====Example====
 +
:<code>@+id/calculateDrivingDistance_withCallbackAction_result</code> - targetColumnNameOrWidgetIdNumber<br>
 +
:<code>@+id/calculateDrivingDistance_withCallbackAction_pointOne</code> - gpsPoint1<br>
 +
:<code>@+id/calculateDrivingDistance_withCallbackAction_pointTwo</code> - gpsPoint2<br>
 +
:<code>@+id/myCallbackBlock</code> - callbackWidgetWhenDistanceReceived<br>
 +
:<code>gn:act_set</code> - callbackWidgetActionSet<br>
 +
:; <code>[gn:act_calculateDrivingDistance]|[,@+id/calculateDrivingDistance_withCallbackAction_result,,,@+id/myCallbackBlock,gn:act_set;@variable/calculateDrivingDistance_withCallbackAction_pointOne,@variable/calculateDrivingDistance_withCallbackAction_pointTwo]</code>
 +
<hr>
  
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
+
===Calculate driving distance and store result into [[Datatypes#rows|rows]] (M103.8.0.5)===
|-
+
 
! scope="col" | Parameter
+
:;<code>[gn:act_calculateDrivingDistance]|[targetRows,targetColumnNameOrWidgetIdNumber,targetColumnNameOrWidgetIdText,targetTextSuffix;gpsPoint1,gpsPoint2]</code>
! scope="col" | Description
 
|-
 
| <code>[[target]]</code>
 
| [[target]] into which calculated driving distance will be stored
 
* Valid [[target|targets]]:
 
:*<code>[[Datatypes#number|number]]</code>
 
|-
 
| <code>sourceColumnName</code>
 
| column from where [[Datatypes#gps|gps]] coordinate will be used for calculation
 
* Can be:
 
:*<code>hardcoded</code>
 
|-
 
| <code>[[source|source2]]</code>
 
| [[source]] from where [[Datatypes#gps|gps]] coordinate will be used for calculation
 
* Valid [[source|sources]]:
 
:*<code>[[Datatypes#gps|gps]]</code>
 
|-
 
| <code>[[source|targetColumnName]]</code>
 
| [[Datatypes#rows|rows]] column name where the calculated driving distance will be stored
 
* Valid [[source|sources]]:
 
:*<code>hardcoded</code>
 
|-
 
|}
 
  
 
====Example====
 
====Example====
:<code>@variable/finalDeviceList</code> - target<br>
+
:<code>@variable/calculateDrivingDistance_storeResultIntoRows_rowsResult</code> - targetRows<br>
:<code>@+id/gpsInput</code> - source1<br>
+
:<code>devices_km</code> - targetColumnNameOrWidgetIdNumber<br>
:<code>@+id/deviceGps</code> - source2<br>
+
:<code>devices_kmText</code> - targetColumnNameOrWidgetIdText<br>
:<code>devices_inventoryNumber</code> - searchColumnName<br>
+
:<code>@variable/calculateDrivingDistance_storeResultIntoRows_rowsResult_km</code> - targetTextSuffix<br>
:<code>@variable/deviceNumber</code> - searchColumnValueId<br>
+
:<code>devicesFullInfo_gps</code> - gpsPoint1<br>
:<code>device_km</code> - targetColumnName<br>
+
:<code>@variable/calculateDrivingDistance_storeResultIntoRows_pointOne</code> - gpsPoint2<br>
:; ⤷ <code>[gn:act_calculateDrivingDistance]|[@variable/finalDeviceList,gps,@+id/deviceGps;device_gps]</code>
+
:; ⤷ <code>[gn:act_calculateDrivingDistance]|[@variable/calculateDrivingDistance_storeResultIntoRows_rowsResult,devices_km,devices_kmText,@variable/calculateDrivingDistance_storeResultIntoRows_rowsResult_km;devicesFullInfo_gps,@variable/calculateDrivingDistance_storeResultIntoRows_pointOne]</code>
 
<hr>
 
<hr>
  
===Calculate driving distance and store result into [[Datatypes#rows|rows]] with callback action===
+
===Calculate driving distance and store result into [[Datatypes#rows|rows]] with callback action (M103.8.0.5)===
 +
 
 +
:;<code>[gn:act_calculateDrivingDistance]|[targetRows,targetColumnNameOrWidgetIdNumber,targetColumnNameOrWidgetIdText,targetTextSuffix,callbackWidgetWhenDistanceReceived,callbackWidgetActionSet;gpsPoint1,gpsPoint2]</code>
 +
 
 +
====Example====
 +
:<code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult</code> - targetRows<br>
 +
:<code>devices_km</code> - targetColumnNameOrWidgetIdNumber<br>
 +
:<code>devices_kmText</code> - targetColumnNameOrWidgetIdText<br>
 +
:<code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km</code> - targetTextSuffix<br>
 +
:<code>@+id/myCallbackBlock</code> - callbackWidgetWhenDistanceReceived<br>
 +
:<code>gn:act_set</code> - callbackWidgetActionSet<br>
 +
:<code>devicesFullInfo_gps</code> - gpsPoint1<br>
 +
:<code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo</code> - gpsPoint2<br>
 +
:<code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree</code> - gpsPoint3<br>
 +
:; ⤷ <code>[gn:act_calculateDrivingDistance]|[@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult,devices_km,devices_kmText,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km,@+id/myCallbackBlock,gn:act_set;devicesFullInfo_gps,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree]</code>
  
:;<code>[gn:act_calculateDrivingDistance]|[rowsTarget,sourceColumnName,source,searchColumnName,searchColumnValueId;numericTargetColumnName,stringTargetColumnName,stringSuffix;eventWidgetId,event]</code>
+
=====Explanation=====
 +
For each row in <code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult</code>
 +
:- get the datatype GPS value of the column named <code>devicesFullInfo_gps</code>, <code>calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo</code>,<code>calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree</code>
 +
:- asynchronously connect to our osrm server, send gpsPoints and get the distance
 +
:- store the distance into rows <code>calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult</code> same row from where gpsPoints were taken in column <code>devices_km</code> with number DT
 +
:- store the distance (with suffix read from <code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km</code>) into rows <code>calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult</code> same row from where gpsPoints were taken in column <code>devices_kmText</code> with text DT
 +
:- execute callback on widget <code>@+id/myCallbackBlock</code> for action <code>gn:act_set</code>  
  
:{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
+
===Calculate driving distance and store result into [[Datatypes#rows|rows]] with ALL DONE callback action (M103.8.0.5)===
|-
+
 
! scope="col" | Parameter
+
:;<code>[gn:act_calculateDrivingDistance]|[targetRows,targetColumnNameOrWidgetIdNumber,targetColumnNameOrWidgetIdText,targetTextSuffix,callbackWidgetWhenDistanceReceived,callbackWidgetActionSet,,callbackWidgetWhenAllDone,callbackWidgetWhenAllDoneActionSet;gpsPoint1,gpsPoint2]</code>
! scope="col" | Description
 
|-
 
| <code>[[target]]</code>
 
| [[target]] into which calculated driving distance will be stored
 
* Valid [[target|targets]]:
 
:*<code>[[Datatypes#number|number]]</code>
 
|-
 
| <code>sourceColumnName</code>
 
| column from where the end [[Datatypes#gps|gps]] coordinate will be used for calculation
 
* Valid [[source|sources]]:
 
:*<code>[[Datatypes#gps|gps]]</code>
 
|-
 
| <code>[[source|source]]</code>
 
| [[source]] from where the start [[Datatypes#gps|gps]] coordinate will be used for calculation
 
* Valid [[source|sources]]:
 
:*<code>[[Datatypes#gps|gps]]</code>
 
|-
 
| <code>[[source|searchColumnName]]</code>
 
| [[Datatypes#rows|rows]] column name which will be searched for specific searchColumnValue
 
* Valid [[source|sources]]:
 
:*<code>hardcoded</code>
 
|-
 
| <code>[[source|searchColumnValueId]]</code>
 
| [[source]] from which the value will be used for matching correct row by checking <code>searchColumnName</code> column
 
* Valid [[source|sources]]:
 
:*<code>any source</code>
 
|-
 
| <code>[[source|numericTargetColumnName]]</code>
 
| [[Datatypes#rows|rows]] column name where the calculated driving distance will be stored as number
 
* Valid [[source|sources]]:
 
:*<code>hardcoded</code>
 
|-
 
| <code>[[source|stringTargetColumnName]]</code>
 
| [[Datatypes#rows|rows]] column name where the calculated driving distance will be stored as text
 
* Valid [[source|sources]]:
 
:*<code>hardcoded</code>
 
|-
 
| <code>[[source|stringSuffix]]</code>
 
| suffix value displayed in stringTargetColumnName
 
* Valid [[source|sources]]:
 
:*<code>[[Datatypes#text|text]]</code>
 
|-
 
| <code>[[source|eventWidgetId]]</code>
 
| [[target]] on which defined <code>event</code> will be executed
 
* Valid [[source|sources]]:
 
:*<code>[[Datatypes#number|number]]</code>
 
|-
 
| <code>[[:Category:Events|event]]</code>
 
| [[:Category:Events|event]] which will be fired after action is executed
 
* Valid [[source|sources]]:
 
:*<code>hardcoded</code>
 
|-
 
|}
 
  
 
====Example====
 
====Example====
:<code>@variable/finalDeviceList</code> - rows with devices<br>
+
:<code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult</code> - targetRows<br>
:<code>devices_gps </code> - column in finalDeviceList variable, with GPS<br>
+
:<code>devices_km</code> - targetColumnNameOrWidgetIdNumber<br>
:<code>@+id/gpsInput</code> - widget with GPS position<br>
+
:<code>devices_kmText</code> - targetColumnNameOrWidgetIdText<br>
:<code>devices_km</code> - target column, which will store result in meters, like 1200<br>
+
:<code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km</code> - targetTextSuffix<br>
:<code>devices_kmText</code> - target column, which will store result in text view, like "1,2 km"<br>
+
:<code>@+id/myCallbackBlock</code> - callbackWidgetWhenDistanceReceived<br>
:<code>@variable/km</code> - text variable wich contains " km" text<br>
+
:<code>gn:act_set</code> - callbackWidgetActionSet<br>
:<code>@+id/onDistanceArrived</code> - callback widget<br>
+
:<code>devicesFullInfo_gps</code> - gpsPoint1<br>
:<code>gn:act_set</code> - callback action<br>
+
:<code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo</code> - gpsPoint2<br>
:; ⤷ <code>[gn:act_calculateDrivingDistance]|[@variable/finalDeviceList,devices_gps,@+id/gpsInput;devices_km,devices_kmText,@variable/km;@+id/onDistanceArrived,gn:act_set]</code>
+
:<code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree</code> - gpsPoint3<br>
 +
:<code>@+id/myCallbackBlockAllDone</code> - callbackWidgetWhenAllDone<br>
 +
:<code>gn:act_set</code> - callbackWidgetActionSet<br>
 +
:; ⤷ <code>[gn:act_calculateDrivingDistance]|[@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult,devices_km,devices_kmText,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km,@+id/myCallbackBlock,gn:act_set,,@+id/myCallbackBlockAllDone,gn:act_set;devicesFullInfo_gps,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree]</code>
  
 
=====Explanation=====
 
=====Explanation=====
For each row in <code>@variable/finalDeviceList</code>
+
For each row in <code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult</code>
:- get the datatype GPS value of the column named <code>devices_gps</code>
+
:- get the datatype GPS value of the column named <code>devicesFullInfo_gps</code>, <code>calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo</code>,<code>calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree</code>
:- asynchronously connect to our osrm server and send startPoint GPS <code>@+id/gpsInput</code> and endPoint GPS value of column <code>devices_gps</code> and get the distance
+
:- asynchronously connect to our osrm server, send gpsPoints and get the distance
:- store the distance into same row in column <code>devices_km</code> with number DT
+
:- store the distance into rows <code>calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult</code> same row from where gpsPoints were taken in column <code>devices_km</code> with number DT
:- store the distance (with suffix read from <code>@variable/km</code>) into same row in column <code>devices_kmText</code> with text DT
+
:- store the distance (with suffix read from <code>@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km</code>) into rows <code>calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult</code> same row from where gpsPoints were taken in column <code>devices_kmText</code> with text DT
:- execute callback on widget <code>@+id/onDistanceArrived</code> for action <code>gn:act_set</code>  
+
:- execute callback on widget <code>@+id/myCallbackBlock</code> for action <code>gn:act_set</code>
 +
 
 +
:- after all rows are done, execute callback on widget <code>@+id/myCallbackBlockAllDone</code> for action <code>gn:act_set</code>  
 
<hr>
 
<hr>

Latest revision as of 10:30, 23 October 2020

gn:act_calculateDrivingDistance

Description
Action is used to calculate driving distance between two GPS coordinates and store the result into target
In order for this action to work, an internet connection must be active because the calculations are done by OSRM server.
In case there is no internet connection, targetColumnNameOrWidgetIdNumber and targetColumnNameOrWidgetIdText will not be updated.
Action returns
void

Action signatures

Full signature (M103.8.0.5)

[gn:act_calculateDrivingDistance]|[targetRows,targetColumnNameOrWidgetIdNumber,targetColumnNameOrWidgetIdText,targetTextSuffix,callbackWidgetWhenDistanceReceived,callbackWidgetActionSet,targetIdColumnNameOrWidgetIdTextNumberFormat,callbackWidgetWhenAllDone,callbackWidgetWhenAllDoneActionSet;gpsPointsDataBlock{n}]
Parameter Description
targetRows target target rows which can be used as source for calculating distance and target for storing calculated distance
targetColumnNameOrWidgetIdNumber target column in row or widget into which calculated distance will be stored
  • rowColumnId id of column in case we want to store into row, column must be of type number
  • widgetId id of widget, widget must support and be of type number
targetColumnNameOrWidgetIdText target column in row or widget into which calculated distance will be stored as text. targetTextSuffix will be appended as suffix to the value
  • rowColumnId id of column in case we want to store into row, column must be of type text
  • widgetId id of widget, widget must support and be of type text
targetTextSuffix source suffix which will be added to targetColumnNameOrWidgetIdText
callbackWidgetWhenDistanceReceived target on which is defined callbackWidgetActionSet
  • widgetId
callbackWidgetActionSet event action set name which will be fired after distance is calculated and stored
  • hardcoded
targetIdColumnNameOrWidgetIdTextNumberFormat (optional) number formatting for targetColumnNameOrWidgetIdText parameter. Default format 0.00 For valid formats see Formats
gpsPointsDataBlock{n} sources which will be included into calculation
  • gps widgets and/or column id's in case targetRows is defined
callbackWidgetWhenAllDone target on which is defined callbackWidgetWhenAllDoneActionSet
  • widgetId
callbackWidgetWhenAllDoneActionSet event action set name which will be fired after all distances are calculated and stored
  • hardcoded

Calculate driving distance (M103.8.0.5)

[gn:act_calculateDrivingDistance]|[,targetColumnNameOrWidgetIdNumber;gpsPoint1,gpsPoint2]

Example

@+id/calculateDrivingDistance_calculateDrivingDistance_result - targetColumnNameOrWidgetIdNumber
@+id/calculateDrivingDistance_calculateDrivingDistance_pointOne - gpsPoint1
@+id/calculateDrivingDistance_calculateDrivingDistance_pointTwo - gpsPoint2
@+id/calculateDrivingDistance_calculateDrivingDistance_pointThree - gpsPoint3
@+id/calculateDrivingDistance_calculateDrivingDistance_pointFour - gpsPoint4
⤷ [gn
act_calculateDrivingDistance]|[,@+id/calculateDrivingDistance_calculateDrivingDistance_result;@variable/calculateDrivingDistance_calculateDrivingDistance_pointOne,@variable/calculateDrivingDistance_calculateDrivingDistance_pointTwo,@variable/calculateDrivingDistance_calculateDrivingDistance_pointThree,@variable/calculateDrivingDistance_calculateDrivingDistance_pointFour]</code>

Calculate driving distance with callback action (M103.8.0.5)

[gn:act_calculateDrivingDistance]|[,targetColumnNameOrWidgetIdNumber,,,callbackWidgetWhenDistanceReceived,callbackWidgetActionSet;gpsPoint1,gpsPoint2]

Example

@+id/calculateDrivingDistance_withCallbackAction_result - targetColumnNameOrWidgetIdNumber
@+id/calculateDrivingDistance_withCallbackAction_pointOne - gpsPoint1
@+id/calculateDrivingDistance_withCallbackAction_pointTwo - gpsPoint2
@+id/myCallbackBlock - callbackWidgetWhenDistanceReceived
gn:act_set - callbackWidgetActionSet
[gn:act_calculateDrivingDistance]|[,@+id/calculateDrivingDistance_withCallbackAction_result,,,@+id/myCallbackBlock,gn:act_set;@variable/calculateDrivingDistance_withCallbackAction_pointOne,@variable/calculateDrivingDistance_withCallbackAction_pointTwo]

Calculate driving distance and store result into rows (M103.8.0.5)

[gn:act_calculateDrivingDistance]|[targetRows,targetColumnNameOrWidgetIdNumber,targetColumnNameOrWidgetIdText,targetTextSuffix;gpsPoint1,gpsPoint2]

Example

@variable/calculateDrivingDistance_storeResultIntoRows_rowsResult - targetRows
devices_km - targetColumnNameOrWidgetIdNumber
devices_kmText - targetColumnNameOrWidgetIdText
@variable/calculateDrivingDistance_storeResultIntoRows_rowsResult_km - targetTextSuffix
devicesFullInfo_gps - gpsPoint1
@variable/calculateDrivingDistance_storeResultIntoRows_pointOne - gpsPoint2
[gn:act_calculateDrivingDistance]|[@variable/calculateDrivingDistance_storeResultIntoRows_rowsResult,devices_km,devices_kmText,@variable/calculateDrivingDistance_storeResultIntoRows_rowsResult_km;devicesFullInfo_gps,@variable/calculateDrivingDistance_storeResultIntoRows_pointOne]

Calculate driving distance and store result into rows with callback action (M103.8.0.5)

[gn:act_calculateDrivingDistance]|[targetRows,targetColumnNameOrWidgetIdNumber,targetColumnNameOrWidgetIdText,targetTextSuffix,callbackWidgetWhenDistanceReceived,callbackWidgetActionSet;gpsPoint1,gpsPoint2]

Example

@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult - targetRows
devices_km - targetColumnNameOrWidgetIdNumber
devices_kmText - targetColumnNameOrWidgetIdText
@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km - targetTextSuffix
@+id/myCallbackBlock - callbackWidgetWhenDistanceReceived
gn:act_set - callbackWidgetActionSet
devicesFullInfo_gps - gpsPoint1
@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo - gpsPoint2
@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree - gpsPoint3
[gn:act_calculateDrivingDistance]|[@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult,devices_km,devices_kmText,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km,@+id/myCallbackBlock,gn:act_set;devicesFullInfo_gps,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree]
Explanation

For each row in @variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult

- get the datatype GPS value of the column named devicesFullInfo_gps, calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo,calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree
- asynchronously connect to our osrm server, send gpsPoints and get the distance
- store the distance into rows calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult same row from where gpsPoints were taken in column devices_km with number DT
- store the distance (with suffix read from @variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km) into rows calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult same row from where gpsPoints were taken in column devices_kmText with text DT
- execute callback on widget @+id/myCallbackBlock for action gn:act_set

Calculate driving distance and store result into rows with ALL DONE callback action (M103.8.0.5)

[gn:act_calculateDrivingDistance]|[targetRows,targetColumnNameOrWidgetIdNumber,targetColumnNameOrWidgetIdText,targetTextSuffix,callbackWidgetWhenDistanceReceived,callbackWidgetActionSet,,callbackWidgetWhenAllDone,callbackWidgetWhenAllDoneActionSet;gpsPoint1,gpsPoint2]

Example

@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult - targetRows
devices_km - targetColumnNameOrWidgetIdNumber
devices_kmText - targetColumnNameOrWidgetIdText
@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km - targetTextSuffix
@+id/myCallbackBlock - callbackWidgetWhenDistanceReceived
gn:act_set - callbackWidgetActionSet
devicesFullInfo_gps - gpsPoint1
@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo - gpsPoint2
@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree - gpsPoint3
@+id/myCallbackBlockAllDone - callbackWidgetWhenAllDone
gn:act_set - callbackWidgetActionSet
[gn:act_calculateDrivingDistance]|[@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult,devices_km,devices_kmText,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km,@+id/myCallbackBlock,gn:act_set,,@+id/myCallbackBlockAllDone,gn:act_set;devicesFullInfo_gps,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo,@variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree]
Explanation

For each row in @variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult

- get the datatype GPS value of the column named devicesFullInfo_gps, calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointTwo,calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_pointThree
- asynchronously connect to our osrm server, send gpsPoints and get the distance
- store the distance into rows calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult same row from where gpsPoints were taken in column devices_km with number DT
- store the distance (with suffix read from @variable/calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult_km) into rows calculateDrivingDistance_storeResultIntoRowsWithCallbackAction_rowsResult same row from where gpsPoints were taken in column devices_kmText with text DT
- execute callback on widget @+id/myCallbackBlock for action gn:act_set
- after all rows are done, execute callback on widget @+id/myCallbackBlockAllDone for action gn:act_set