Populate Latitude Longitude fields offline

3876
1
05-07-2013 11:39 AM
GarrettMoeller
New Contributor III
Greetings,
I am trying to use the example provided in ArcPad help to populate Latitude Longitude fields offline.
I have taken the example from:
http://help.arcgis.com/en/arcpadstudio/10.0/scripting/Sample%2010.html

And am working with the JScript version


function AddXYValues(p_pRS, p_XFieldName, p_YFieldName)
{
      var pFields = p_pRS.Fields;
      p_pRS.MoveFirst();
      while (!p_pRS.EOF)
      {
              pFields(p_XFieldName).Value = pFields.Shape.X;
            pFields(p_YFieldName).Value = pFields.Shape.Y;
            p_pRS.Update();
            p_pRS.MoveNext();
      }
}

// here's an example of calling AddXYValues to populate the LATITUDE and LONGITUDE fields of layer 1
Map.Layers(1).Editable = true;
var pRS = Map.Layers(1).Records;
AddXYValues(pRS, "LONGITUDE", "LATITUDE");
pRS = null;
Map.Layers(1).Editable = false;


I have replaced the references to (1) with my layer name (LeakInspection)
I also added to my .apl file the reference:
<SCRIPT src="JScript1.js" language="JScript"/>

What else do I need to do?
It doesn't seem to be reading the source? (Please reference attached image)[ATTACH=CONFIG]24104[/ATTACH]
Tags (3)
0 Kudos
1 Reply
GarethWalters
Occasional Contributor III
Hi Garrett,

You need to put your layer name in double quotes - "LeakInspection".

The example is passing an integer where you want to pass a text string as the reference. The way you have it written, the script is actually looking for a variable called LeakInspection.

That should get you over the line.

I hope this helps.

Cheers,

Gareth