update_report
The update_report function is used to create, edit, and delete report templates.
svc=report/update_report¶ms={"itemId":<long>,
"id":<long>,
"callMode":"<text>",
"n":"<text>",
"ct":"<text>",
"p":"<text>",
"tbl":[
{
"n":"<text>",
"l":"<text>",
"c":"<text>",
"cl":"<text>",
"cp":"<text>",
"s":"<text>",
"sl":"<text>",
"filter_order":"<text>",
"p":"<text>",
"sch":{
"f1":<uint>,
"f2":<uint>,
"t1":<uint>,
"t2":<uint>,
"m":<uint>,
"y":<uint>,
"w":<uint>,
"fl":<uint>
},
"f":<uint>
}
]}
Parameters
Name | Description |
---|---|
itemId | Resource ID. |
id | Template ID. |
callMode | Action: create, update, delete. |
Other parameters are only required to create and edit templates. They are described on the get_report_data page.
The p parameter specifies the grouping of the table and other settings. Example:
"p":"{
\"grouping\":\"
{\"type\":\"total\",\"nested\": /* enable grouping "Total" */
{\"type\":\"year\"}}\" /* enable nested grouping "Year" */
}"
}"
Basic grouping types:
Type | Description |
---|---|
total | Total. |
year | Year. |
month | Month. |
week | Week. |
wday | Day of the week. |
mday | Day of the month. |
day | Date. |
shift | Shift. |
To see the advanced grouping types, get the table information using the get_report_tables request (the gt parameter).
For the account_tree table, the following parameters can be used:
"p": "{
\"account_tree\":{
\"group\":<bool>,
\"types\":"<text>"
}
}"
Name | Description |
---|---|
group | Grouping the elements:
The default value is 0. |
types | Element types included in the table results:
By default, all element types are included. |
Example (all double quotes within the value must be escaped):
"p":"{\"account_tree\":{\"group\":1,\"types\":\"avl_account,avl_resource,user,avl_unit,avl_unit_group,avl_retranslator,avl_route\"}}"
For the driver_ddd table, the drv_activity (Driver activity source) parameter can be used:
"p": "{
\"drv_activity\":"<text>"
}"
Value | Description |
---|---|
ddd | Use data from the .ddd files (by default). |
online | Use the data from online activities. |
binds_and_trips | Use the data from assignment and trip activities. |
For the driver_orders table (Orders), order_filter (Filtration) parameter can be used:
"p":"{
\"order_filter\":<uint>
}"
Value | Description |
---|---|
0x1 | Visited orders. Deprecated. |
0x2 | Not visited orders. Deprecated. |
0x4 | Orders visited in time. Deprecated. |
0x8 | Orders visited late. Deprecated. |
0x10 | Confirmed and rejected orders. |
0x20 | Not confirmed and not rejected orders. |
0x40 | Confirmed orders. |
0x80 | Rejected orders. |
0x100 | Visited orders. |
0x200 | Not visited orders. |
0x400 | Orders visited in time. |
0x800 | Orders visited late. |
For the unit_counter_sensors (Counter sensors), the following parameters can be used:
- sensor_val:min (minimum sensor value);
- sensor_val:max (maximum sensor value).
"p": "{
\"sensor_val\":{\"min\":\"10\",\"max\":\"14\"}
}"
For charts:
"p":"{
\"sensor_mask\":"<text>", /* sensor mask */
\"instant_speed_base\":{
\"mask\":"<text>"}} /* sensor mask to colour the chart line by sensor */
To split shifts in the tables with shifts, use the following parameters:
"p":{\"split_shifts\":1},
"s":{\"split_shifts\"}
Charts
A chart is a table in a template.
To add markers to the chart, add marker table to the template and marker flags to the chart table. Marker table code sample:
{"n":"unit_events",
"l":"",
"f":0,
"c":"",
"cl":"",
"p":"",
"sch":{
"y":0,
"m":0,
"w":0,
"f1":0,
"f2":0,
"t1":0,
"t2":0},
"sl":"",
"s":"[\"chart_unit_events\"]"},
Сode sample for marker flags:
"p":"{
\"chart_markers\":{
\"f\":2556}
}"
}
Available markers/states:
Marker | Flag | Description |
---|---|---|
unit_events | 0x4 | Events. |
unit_fillings | 0x8 | Fuel fillings. |
unit_photos | 0x10 | Images. |
unit_stays | 0x20 | Parkings. |
unit_speedings | 0x40 | Speedings. |
unit_stops | 0x80 | Stops. |
unit_thefts | 0x100 | Fuel drains. |
unit_videos | 0x800 | Video. |
To change charts’ background according to the state of the units, add marker/state to the template and chart_regions parameter to the chart table.
ID | Description |
---|---|
chart_stops_regions | Stops. |
chart_engine_hours_regions | Engine hours. |
chart_conn_quality_regions | Connection loss. |
chart_stays_regions | Parkings. |
chart_trips_regions | Trips. |
chart_speedings_regions | Speedings. |
chart_digital_sensors_regions | Digital sensors. |
Advanced settings
Every template setting is a table column. To activate an option, add the corresponding column to the template.
The following settings are available:
Table | Column | Description |
---|---|---|
unit_stats | multi_drivers | Multiple drivers/trailers. |
unit_stats | precise_calculations | Mileage/Fuel/Counters with a precision of up to two decimal places. |
unit_stats | exclude_thefts | Exclude fuel drains from fuel consumption. |
unit_stats | trips_mileage | Mileage from trips only. |
unit_stats | intersect_zone | Consider track-geofence intersections. |
unit_stats | address_format | Address format. |
unit_stats | time_format | Time format. |
unit_stats | us_units | Measurement system. |
unit_stats | shifts | Shifts. |
unit_trips | render_msgs | All messages on map. |
unit_trips | render_trips | Trip routes. |
geozones | render_geozones | Render geofences. |
unit_videos | render_unit_videos | Video markers. |
unit_fillings | render_filling_markers | Filling markers. |
unit_photos | render_unit_photos | Image markers. |
unit_stops | render_stops_markers | Stop markers. |
unit_speedings | render_speedings_markers | Speeding markers. |
unit_thefts | render_theft_markers | Fuel drain markers. |
unit_events | render_events_markers | Event markers. |
unit_stays | render_stays_markers | Parking markers. |
unit_location | render_location_markers | Unit last location. |
unit_stats_zones | all_resources | Geofences from all resources. |
unit_stats_zones | desc_address | Add geofence description to address. |
unit_stats_zones | address_zones | Use geofences for addresses. |
Address format, time format, shift, and measurement system are specified in the **“p”**parameter.
Returned result
For creation and modification requests:
[
<long>, /* template ID */
{
"id":<long>, /* template ID */
"n":"<text>", /* name */
"ct":"<text>", /* template type */
"c":<uint> /* check sum (crc16) */
}
]
Template types are described on the get_report_data page.
For deletion requests:
[
<long>, /* template ID */
null
]
Possible error codes:
Code | Description |
---|---|
7 | Failed to fetch the item with the desired ACL (ADF_ACL_AVL_RES_EDIT_REPORTS). |
6 | Undefined error. |
4 | Wrong input parameters. |