在格式化表达式中进行数据库查找 [英] Doing a database lookup in formatting expression

查看:77
本文介绍了在格式化表达式中进行数据库查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在上面说 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.

推荐答案

您在这里有两个选择:

1)您可以更新您的数据窗口查询,以包含一个附加字段,该字段返回该项目是否存在于另一个表中(根据您使用的数据库,会想到标量子查询)。然后您的数据窗口表达式只检查该列-这是首选解决方案。

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)在数据窗口表达式中,您还可以调用已创建的全局用户定义函数。因此,您将创建一个新函数(File-> New-> PB Object Tab-> Function),该函数将id作为其传入参数,在另一个表中执行查找,然后返回结果。然后,在数据窗口表达式中,您现在可以直接调用此函数以查看该表中是否存在该函数。

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.

这篇关于在格式化表达式中进行数据库查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆