Doing a database lookup in formatting expression

649 views Asked by At

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.

image description

1

There are 1 answers

3
Doug Porter On BEST ANSWER

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.