Select to view content in your preferred language

Fields won't calculate

584
2
04-16-2013 10:21 AM
AmandaSkelding
New Contributor II
Hi,

I am trying to get Arcpad to perform a simple calculation but for some reason it won't do it. Can anyone tell me why this won't work? It is entered in the Form Properties Events under "onOK".

Dim objPage,
Set objPage1 = ThisEvent.Object.Pages("Page1")
Set objPage2 = ThisEvent.Object.Pages("Page2")
objPage2.Controls("Pctdmgvine").Value = CDbl(objPage2.Controls("AvgDmgVine").Value / CDbl(objPage1.Controls("AvgBdsVine").Value)

Thanks for any help,

Alan
Tags (3)
0 Kudos
2 Replies
AaronAmbrose
New Contributor II
I think it has to do with the event that you are tying it to; the OnOK event. I tried to run a script here the other day too and no luck.
It seems that when you try and change values after pressing OK, it ain't gonna happen. Which seems pretty ridiculous if you ask me.
I would love it if there was a work around to this.
Try adding a msgbox("see if this pops up") to your script. I bet you see the message pop up, but still no field value change..., go figure
0 Kudos
AmandaSkelding
New Contributor II
Hi Aronius1; I got this to work:

Dim objPage
Set objPage = ThisEvent.Object.Pages("Page1")
Set objPage2 = ThisEvent.Object.Pages("Page2")
objPage2.Controls("Avgdmgvine").Field.Value = CDbl(objPage2.Controls("Cntdmg5vin").Value)/5
objPage2.Controls("Pctdmgvine").Field.Value = CDbl(objPage2.Controls("Avgdmgvine").Field.Value) / CDbl(objPage.Controls("Avgbdsvine").Field.Value)

Note that the onOK event used is under the Form Controls properties (if that makes a difference or not I'm not sure). Oddly though this only works for a shapefile. When I tried to use it on a Feature Class from a GDB it produces different pages and thus doesn't work yet.
0 Kudos