AnsweredAssumed Answered

Array Issue

Question asked by gus6177 on Sep 10, 2015
Latest reply on Sep 16, 2015 by gus6177
Branched to a new discussion

I'm a novice at js.  have the following js code I'm have an issue with.  I get the following error "Unable to get property 'toFixed' of undefined or null reference"

 

Here is the code. I was trying to add line 13 to return a second set of results from the LRM_DC_RM_MI1 table.  When I add break points through the console it appears to return the correct values.  Any idea what I'm doing wrong.

 


 

function (jobInfo) {

this.gp.getResultData(jobInfo.jobId, "LRM_DR1", lang.hitch(this, this.renderResult));

this.gp.getResultData(jobInfo.jobId, "LRM_DC_RM_MI1", lang.hitch(this, this.renderResult));

function (result) {

this.shelter.hide();

var resultArray = result.value.features;

var resultString = '<table class="test"><tr><td>Route</td><td>Accumulated Mileage</td></tr>';

if (resultArray.length > 0) {

//loop through and populate table


for (var i = 0; i < resultArray.length; i++) {

'<tr><td>' + resultArray[i].attributes.RID + '</td><td>' + resultArray[i].attributes.MEAS.toFixed(3) + '</td></tr>';

'<tr><td>' + resultArray[i].attributes.ROUTE + '</td><td>' + resultArray[i].attributes.OFFSETtoFixed(3) + '</td></tr>';

'</table>';

else {

//Return No results message


"No result Returned please click on Route";

 

Outcomes