Array Issue

3476
11
Jump to solution
09-10-2015 12:31 PM
TerryGustafson
Occasional Contributor II

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.attributes.RID + '</td><td>' + resultArray.attributes.MEAS.toFixed(3) + '</td></tr>';

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

'</table>';

else {

//Return No results message


"No result Returned please click on Route";

0 Kudos
11 Replies
TerryGustafson
Occasional Contributor II

I think I’m passing the corridor and the offset in as the x/y coordinate..

0 Kudos
JoshHevenor
Occasional Contributor II

Use f12 to get the browser debug tools.  Find the Debug tab and put a breakpoint in before your problem. You can step to the offending line and mouse-over to inspect. This is more or less the same in all the major browsers.

You can also use the term debugger; in your code to force a breakpoint.