列中的 VBScript 条件值
我在 Manifold GIS 数据库中使用 VBScript 使用 Trig 函数验证两个经度和纬度点之间的距离。用于查找跑步距离的脚本没有任何问题,但用于验证 OD 是否有效的脚本有语法错误。我真的希望你们中的任何人都可以帮助我解决这个问题。
我创建了 2 个新的活动列:距离和验证距离。创建距离列是为了使用 Trig 函数查找距离。它运行成功,但可能需要对其混乱的结构进行改进。 VerifyDistance 使用 IF 条件并检查名为“Valid O/D”的另一列中的值。如果值为“OK”,则返回Distance值;否则,它将在该列中返回一个文本值,指出“OD 点无效”。
正如你所看到的,我是编程语言的新手。 VBScript 如下所示:
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在这里缺少
Then
。You are missing
Then
here.