1 Reply Latest reply on Jan 14, 2018 3:09 PM by sc-3 RSS
    sc-3 Explorer

    Error - Unable To Convert From org.mozilla.javascript.Undefined to LOCATION

    var info = me.SampleData
    var params = {
    infoTableName : "InfoTable",
    dataShapeName : "En.LineMapInput"
    };
    
    // CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(En.PolyLineMapInput)
    var data = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
    var newEntry = new Object();
    
    var ssLoc = me.Location
    var locNE = NEB
    var locNW = NWB
    var locSE = SEB
    var locSW = SWB
    
    // distanceBetween(loc1:LOCATION,loc2:LOCATION,units:STRING):NUMBER
    var diffNE = distanceBetween(ssLoc, locNE, "K");
    var diffNW = distanceBetween(ssLoc, locNW, "K");
    var diffSE = distanceBetween(ssLoc, locSE, "K");
    var diffSW = distanceBetween(ssLoc, locSW, "K");
    
    if(diffNE < 12 && diffNW < 12 && diffSE < 12 && diffSW < 12)
    {
    //    info.getRowCount()
        for(var i = 0; i < info.getRowCount(); i++)
        {
            newEntry.description = info.rows[i].description; // STRING
            newEntry.refid = info.rows[i].refid; // NUMBER - isPrimaryKey = true
            newEntry.id = info.rows[i].id; // STRING
            newEntry.point = info.rows[i].point; // LOCATION
            data.AddRow(newEntry);
        }
        result = data
    }
    else
    {
        newEntry.description = info.rows[0].description; // STRING
        newEntry.refid = info.rows[0].refid; // NUMBER - isPrimaryKey = true
        newEntry.id = info.rows[0].id; // STRING
        newEntry.point = info.rows[0].point; // LOCATION
        data.AddRow(newEntry);
       
        result = data
    }
    
    
    }res
    }
    

     

    Hi all I have created a service like mentioned above.. When i loading a mashup i am getting an error like "Wrapped java.lang.Exception: Unable To Convert From org.mozilla.javascript.Undefined to LOCATION" on Application log.

     

    *Note : NEB,NWB,SEB,SWB are inputs (Location basetype)

    How can i resolve this issue?

     

    Thanks & Regards,

    Sathishkumar C.

      • Re: Error - Unable To Convert From org.mozilla.javascript.Undefined to LOCATION
        supandey Ninja

        Hi Sathishkumar, do you know at specifically which point this error is thrown? Can you add logging to both of the calls data.AddRow(newEntry);


        Additionally, I would also recommend, since you are creating custom services it'd be easier to debug, to have stack tracing enabled from the ThingWorx > Subsystem > Logging subsystem

         

        Once this is enabled, reproduce this issue and this should add more info to the Error.log. May be you can also share the applicationlog and the error log here.