From a6b8bc2fcbbca240d7c0cef9bfd89fc0e68131fe Mon Sep 17 00:00:00 2001 From: dab09 Date: Wed, 12 Apr 2023 14:30:01 -0400 Subject: [PATCH 1/2] MYG-53314 - Adding VIN to CSV for import Need a review, adding VIN to SDK example to simplify for resellers, Fleet Managers. --- src/software/js-samples/importDevices.html | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/software/js-samples/importDevices.html b/src/software/js-samples/importDevices.html index 8c9cda455..4c8436614 100644 --- a/src/software/js-samples/importDevices.html +++ b/src/software/js-samples/importDevices.html @@ -1,4 +1,4 @@ - + @@ -39,7 +39,7 @@

Import devices

on its own line as follows:

-
SerialNumber,Name1,GroupName
SerialNumber,Name2,GroupName
SerialNumber,Name3,GroupName
+
SerialNumber,Name1,GroupName,VIN
SerialNumber,Name2,GroupName,VIN
SerialNumber,Name3,GroupName,VIN

@@ -109,8 +109,8 @@

Help

// Split up the device properties var split = devices[i].split(","); - // Each imported device can only have 3 properties - if (split.length !== 3) { + // Each imported device can only have 4 properties + if (split.length !== 4) { alert("There is an error on line " + (i + 1) + ": " + devices[i]); return; } @@ -124,7 +124,10 @@

Help

alert("Group name on line " + (i + 1) + " exceeds 255 characters"); return; } - + if (split[3].length > 255) { + alert("Group name on line " + (i + 1) + " exceeds 255 characters"); + return; + } // If create groups is enabled, queue up the new groups to be created if (!groupCache.hasOwnProperty(split[2])) { if (createGroups) { @@ -176,7 +179,7 @@

Help

}); - function addDevice(serialNumber, name, groupId) { + function addDevice(serialNumber, name, groupId, vin) { api.call("Add", { typeName: "Device", entity: { @@ -184,8 +187,9 @@

Help

name: name, groups: [{ id: groupId - }] - } + }], + vin: vin + } }, function (result) { console.log("Successfully imported " + name + " (" + result + ")"); }, function (error) { From 6b56bdfdfd02d936f074dd1b45a37d86742c9714 Mon Sep 17 00:00:00 2001 From: dab09 Date: Wed, 12 Apr 2023 14:51:22 -0400 Subject: [PATCH 2/2] formatting error. updating formatting error/spacing --- src/software/js-samples/importDevices.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/software/js-samples/importDevices.html b/src/software/js-samples/importDevices.html index 4c8436614..515767071 100644 --- a/src/software/js-samples/importDevices.html +++ b/src/software/js-samples/importDevices.html @@ -189,7 +189,7 @@

Help

id: groupId }], vin: vin - } + } }, function (result) { console.log("Successfully imported " + name + " (" + result + ")"); }, function (error) {