Hi guys,
You can't access the Repeat attributes button directly but I have a work around for Shapefiles that you might want to try. P.s. The AXF version is coming!
Now, a little background for anyone else who stumbles across this thread. When you load a .shp, ArcPad reads the associated .APL to determine how the shape will be symbolised, at what scale etc.
When you edit in ArcPad it reads the .APL into memory and you can just use the repeat attributes tool for the session and turn it on and off manually.
But in ArcPad 10, "Field History" was introduced and is written into the .APL s. When you save the map the last feature that you edited will be saved, so if you exit for the day, or lunch or maybe (just maybe) ArcPad crashes, the values are stored in the APL and you can carry on from where you were.
So the tags looks like this in the .APL, and we can read them via a script.
<FIELDHISTORY>
<FIELDS repeat="true">
<FIELD name="SOMETHING" value="fgaerge"/>
<FIELD name="ID" value="ftgfg"/>
</FIELDS>
</FIELDHISTORY>
As I said, the important thing to remember is that the APL is loaded into memory every time a layer is opened and you cannot play with these tags. So the work around is to remove the layer, play with the .APL tags and then reload it. Therefore the next time you load the shapefile the tags that are read would look like this:
<FIELDHISTORY>
<FIELDS>
<FIELD name="SOMETHING" value="fgaerge"/>
<FIELD name="ID" value="ftgfg"/>
</FIELDS>
</FIELDHISTORY>
Here is a sample script that should "just work" for you on shapefiles.
Dim g_xmlDoc, g_cboLayerSelected, g_filePath
'find the editable layer
Set g_cboLayerSelected = Map.EditLayer
'Get the location of the file
g_filePath = g_cboLayerSelected.filePath
'Get the name of the shapefile
g_shpName = g_cboLayerSelected.name
LoadXML(g_cboLayerSelected)
Function LoadXML(cboLayer)
Set g_xmlDoc = CreateObject("Microsoft.XMLDOM")
g_xmlDoc.load Left(g_filePath,Len(g_filePath)-3) & "apl"
GetSetFieldHistory(cboLayer)
End Function
Function GetSetFieldHistory(cboLayer)
Dim FieldsNode, attrRepeat
Set FieldsNode = g_xmlDoc.SelectSingleNode("//FIELDS")
attrRepeat = FieldsNode.GetAttribute("repeat")
If attrRepeat = "true" then
Map.Layers.Remove(g_cboLayerSelected)
Map.Refresh()
Map.Save()
FieldsNode.removeAttribute("repeat")
g_xmlDoc.save Left(g_filePath,Len(g_filePath)-3) & "apl"
Map.AddLayerFromFile(g_filePath)
Map.Layers(g_shpName).editable = true
End If
Map.Save()
End Function
It is up to you when you run it and obviously it might need some tweaking for your project but it does what you are after. I think 🙂
Cheers,
Gareth