0

6
●4

I have a code that displays an array from GeoTab SDK, I am able to get the array to display in the console.log, and it populates the results like normal, However, When I try to populate the data in the table, nothing shows but the headings.
Here is my code, and I will generate an object array and paste the code as well. I know the data that is generated is valid data,

function generateDutyStatusLogSearch1(){
api.call("Get", {
"typeName": "DutyStatusLog",
"search": {
"statuses": ["D", "OFF", "SB", "ON"],

},

}, function(dutyStatusLogs) {
var uniqueDrivers = {};
var multicall = [];
dutyStatusLogs.forEach(d => {
if (d.driver !== "NoUserId" && !uniqueDrivers[d.driver.id]) {
uniqueDrivers[d.driver.id] = d.driver;
multicall.push(["Get", {
typeName: "User",
search: {
id: d.driver.id
}
}]);
}
});

api.multiCall(multicall, function(drivers) {
drivers.forEach(d => {
uniqueDrivers[d[0].id] = d[0];
});
dutyStatusLogs.forEach(d => {
d.driver = uniqueDrivers[d.driver.id];
});
console.log("Done: ", dutyStatusLogs);
$.each(dutyStatusLogs, function( index, value ) {
 var row = $(value.driver.designation + value.status + value.state + value.driver.comment + value.origin  + value.dateTime);
 $('#demo-table').DataTable({
     paging: false,
     searching: false,
     data: row,

[object Array]: []
     columns: [

    [0...99]: Array
         { title: "Driver" },

[0...9]: Array
         { title: "Status" },

0: Object
         { title: "State" },
dateTime: "2017-11-15T12:15:13.190Z"

         { title: "Comments" },
device: Object
id: "b14"
         { title: "Origin" },

__proto__: Object
         { title: "Date" }
distanceSinceLastValidCoordinate: 0

     ]
driver: Object
acceptedEULA: 0

activeDashboardReports: Array
    });
activeFrom: "2017-11-09T14:22:52.607Z"
activeTo: "2050-01-01"
});
authorityAddress: "5505 State Route 405 SouthPO Box 355Milton, PA 17847"
authorityName: "Milton Transportation"
}, function(e) {

availableDashboardReports: Array
console.error("Failed:", e);

cannedResponseOptions: Array
})
carrierNumber: ""
changePassword: false
comment: ""
companyAddress: "5505 State Route 405 SouthPO Box 355Milton, PA 17847"

companyGroups: Array
companyName: "Milton Transportation"
dateFormat: "MM/dd/yy HH:mm:ss"
defaultGoogleMapStyle: "Roadmap"
defaultHereMapStyle: "Roadmap"
defaultMapEngine: "OpenStreet"
defaultOpenStreetMapStyle: "MapBox"
defaultPage: "map"
designation: "MTGETD18"

driverGroups: Array
employeeNo: "GETD"
firstDayOfWeek: "Sunday"
firstName: "DONALD"
fuelEconomyUnit: "MPGUS"
hosRuleSet: "America8Day"
id: "b45"
isDriver: true
isEULAAccepted: false
isLabsEnabled: false
isMetric: false
isNewsEnabled: true
isPersonalConveyanceEnabled: true
isYardMoveEnabled: true
language: "en"
lastAccessDate: "2017-12-15T13:07:59.813Z"
lastName: "GETZ JR"

mapViews: Array
name: "MTGETD18@MILTONTRANS.COM"

privateUserGroups: Array

reportGroups: Array

securityGroups: Array
showClickOnceWarning: true
timeZoneId: "EST5EDT"
userAuthenticationType: "BasicAuthentication"
viewDriversOwnDataOnly: true
zoneDisplayMode: "Default"

__proto__: Object
editDateTime: "2017-11-16T00:08:41.410Z"
eventCode: 1
eventRecordStatus: 1
eventType: 1
id: "aDvC7Gx3axUeoPCtefvqTVg"

location: Object

location: Object

__proto__: Object
malfunction: "None"
origin: "Manual"
sequence: "0000000000000127"
state: "Active"
status: "OFF"
verifyDateTime: "2017-11-16T00:04:25.670Z"
version: "0000000000003992"

__proto__: Object

constructor: function Object() { [native code] }

hasOwnProperty: function hasOwnProperty() { [native code] }

isPrototypeOf: function isPrototypeOf() { [native code] }

propertyIsEnumerable: function propertyIsEnumerable() { [native code] }

toLocaleString: function toLocaleString() { [native code] }

toString: function toString() { [native code] }

valueOf: function valueOf() { [native code] }

__defineGetter__: function __defineGetter__() { [native code] }

__defineSetter__: function __defineSetter__() { [native code] }

__lookupGetter__: function __lookupGetter__() { [native code] }

__lookupSetter__: function __lookupSetter__() { [native code] }
__proto__: null

}, function(e) {
console.error("Failed:", e);
});
}

I think my error is coming from: var row = $(value.driver.designation + value.status + value.state + value.driver.comment + value.origin + value.dateTime); that is why it is not displaying.

1
Contributor
0
Replies
7
Views
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.