Doing a database lookup in formatting expression

本小妞迷上赌 提交于 2019-12-11 04:56:50

问题


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:


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.



来源:https://stackoverflow.com/questions/4996380/doing-a-database-lookup-in-formatting-expression

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!