列中的 VBScript 条件值

发布于 2024-08-31 07:51:52 字数 794 浏览 2 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄居人 2024-09-07 07:51:52

您在这里缺少 Then

If Record.Data("Valid O/D") = "OK" Then

You are missing Then here.

If Record.Data("Valid O/D") = "OK" Then
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文