在格式化表达式中进行数据库查找
当它显示“blob_curr = 1”时,我需要检查对象 ID 是否存在于另一个表中。我不知道该怎么做。这是一个几年前编写的应用程序,我是一名合作学生,被要求对其进行一些更改,因此我对这个环境的了解非常有限。如果有帮助的话,这是 Powerbuilder 9.0。
Where it says "blob_curr = 1" I need to do a check to see if the object id exists in another table. I have no idea how to do this. This is an application that was written several years ago and I am a co-op student who was asked to make some changes to it so I have very limited knowledge of this environment. This is Powerbuilder 9.0 if that helps.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有两个选项:
1)您可以更新数据窗口查询以包含一个附加字段,该字段返回该项目是否存在于另一个表中(根据您使用的数据库,会想到标量子查询)。然后您的数据窗口表达式只需检查此列 - 这是首选解决方案
2) 在数据窗口表达式中,您还可以调用您创建的全局用户定义函数。因此,您将创建一个新函数(文件 -> 新建 -> PB 对象选项卡 -> 函数),该函数将 id 作为传入参数,在另一个表中执行查找,然后返回结果。然后,在数据窗口表达式中,您现在可以直接调用此函数来查看它是否存在于该表中。
第一种方法可能是最有效的数据库方法。
You have two options here:
1) You can update your datawindow query to include an additional field that returns whether the item exists in the other table (scalar subquery comes to mind depending on what database you are using). Then your datawindow expression just checks this column - This is the preferred solution
2) In a datawindow expression, you can also call global user defined functions that you have created. So you would create a new function (File->New->PB Object Tab->Function), that takes an id as its incoming argument, performs the lookup in the other table and then returns the result. Then within the datawindow expression you can now call this function directly to see if it exists in that table.
The first approach will probably be the most efficient database-wise.