Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: PowerBuilder
Expertise: Beginner
Apr 20, 1997

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 values that have NOT already been selected ?

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

Let me give you some background information:

The problem with DDDWs is that the same data buffer is used to display the data for each row of the parent DataWindow. This is great for keeping 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 not have any problems. The problem comes when you have many rows and each row needs a slightly different view of the data. Because the data buffer is shared between the row, whenever you change one row you change them all.

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

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

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

The longest answer is that you can write a lot of code and basically fake the missing DDDWs. Have an empty text column on your data window and make it the same size as the DDDW. When your users tab into the DDDW, let them use it as normal. When they tab out, find out what they selected and look up the text out of the DDDW. Then put the text in your dummy column and move the dummy column over the top of the DDDW. When they tab into the DDDW, move the text field out of the way. This will take an hour or so of coding and testing but will give you the desired effect. 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.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date