devxlogo

Can I filter DDDW values out of itself?

Can I filter DDDW values out of itself?

Question:
I have a tabular DataWindow with a DDDW. Can I filter the dddw to include only valuesthat have NOT already been selected ?

Answer:
There is a short, a long and a longer answer to this question. The shortanswer is no. The long answer is that it depends on what your drop-downDataWindow looks like.

Let me give you some background information:

The problem with DDDWs is that the same data buffer is used to displaythe data for each row of the parent DataWindow. This is great forkeeping memory usage low, and 95 percent of the time is exactly what you want.

If you are filtering a DDDW with a single parent row of data you do nothave any problems. The problem comes when you have many rows and eachrow needs a slightly different view of the data. Because the data bufferis shared between the row, whenever you change one row you change themall.

Although your users can edit only a single row at any given time,whenever you update the primary buffer of the DDDW, PowerBuilder repaintsall of the views of that data buffer. This is exactly the same concept asthe ShareData command.

Because the DDDWs are repainted when you filter the data, any otherrows are repainted. Thus if your drop-down list box is showing a nicetextual version of a code table, when you filter the rows and removethe already used rows out of the data set, the textual version ofthe other rows is gone and is replaced with the code!

So the long answer is that if you are not displaying textualdescriptions and code only, it will work.

See also  Why ChatGPT Is So Important Today

The longest answer is that you can write a lot of code and basically fakethe missing DDDWs. Have an empty text column on your data window andmake it the same size as the DDDW. When your users tab into the DDDW, letthem use it as normal. When they tab out, find out what theyselected and look up the text out of the DDDW. Then put the text in yourdummy column and move the dummy column over the top of the DDDW. Whenthey tab into the DDDW, move the text field out of the way. This willtake an hour or so of coding and testing but will give you the desiredeffect. The commands to look at are GetChild, SetFilter and Filter,as well as the itemfocuschanged event. To add a dummy column, just add “” to the end of your SQL statement.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist