Hi! I am using VBScript in a Manifold GIS Database to verify the distance between two longitude and latitude points using Trig function. The script for finding the distance run without any problems but the script for verifying whether the O-D is valid had syntax error. I really hope any of you could help me with this problem.
There were 2 new active columns that I created : Distance and VerifyDistance. Distance column was created to find the distance using Trig function. It ran successfuly but may need improvements in its messy structure. The VerifyDistance used the IF conditions and checked the value in another column named "Valid O/D". If the value is "OK", it will return the Distance value; otherwise, it will return a text value saying "O-D points are invalid" in this column.
As you can see, I am a newb in programming language. The VBScript can be seen below:
Function Distance
Distance = sqr((111.21*Record.Data("Work Y-coord") - 111.21*Record.Data("Home Y-coord"))^2 + (85.30*Record.Data("Work X-coord") - 85.30*Record.Data("Home X-coord"))^2)
End Function
Function VerifyDistance
If Record.Data("Valid O/D") = "OK"
VerifyDistance = Record.Data("Distance")
'document.write("Invalid O-D Points")
Else
VerifyDistance = "O-D Points are invalid."
End If
End Function
Thanks a lot for helping me!