Is there a way to filter out some selection options from a dddw at run time? Example, starting with a list of 10 items, and then only showing 7 of those based upon the user's actions. PB 12.8, Windows 10.
Is there a way to filter out some selection options from a dddw at run time? Example, starting with a list of 10 items, and then only showing 7 of those based upon the user's actions. PB 12.8, Windows 10.
Hi James;
I took a few DW's from your PBL that you posted and recreated a working filter on the DDDW column (see attached).
Note: In the future, if you are having difficulties with a design, coding, debugging, support ticket, etc extra effort- you can now open a "Premium" ticket and one of our Appeon staff will be assigned to you to wrestle these to the ground (as best we can).
FYI: https://www.appeon.com/premium-support.html
HTH
Regards ... Chris
Thanks Chris.
I was just using the wrong column, create the child on the column name, set the filter using the dddw index.
Sorry for the trouble
One thing to remember about the DDDW, it is only retrieved once so the same data is used on every row of the main DataWindow. If you filter the DDDW on one row, it will be filtered on all rows.
This won't be a problem if you only have one row.
Looks like there are missing ancestor objects in the example source code that you posted.
So as a test, I created a new datawindow that contains two columns, one of which is mbo_status which has a dddw control placed on it. No matter what I do, I cannot set the filter on the dddw. I'm using GetChild as shown in the code previously. The SetFilter value of -1 equates to "If no DataWindow object has been assigned to the DataWindow or DataStore, SetFilter returns –1". The only error I ever receive is "Catalog tables could not be created and are not available for use", upon startup but I don't know why this would be an issue.
The return code on creating the child is 1, success. The return code on setting the filter for the child is always -1 failure (unless its "" which passes but does nothing). I can set a filter on any other column without a problem, just not on the child.
Thanks for the reply.
No matter what value I place in the filter (ls_filter), the SetFilter statement always returns a -1. If I set the filter to "", null, then no error. I must be referencing the wrong column
James, looking at the code you posted all I can see is
ls_filter = "mbo_status = Open"
If mbo_status is a string column then the word Open needs to be wrapped in quotes.
I.e
ls_filter = "mbo_status = 'Open'"
Other thing I noticed (maybe an issue) if you are getting a display value for mbo_status that tells me it may contain a code. If that is true then you would need to use that code and not the display value for your filter.
I.e. if mbo_status was "O" and display value was "Open" you would need to filter
ls_filter = "mbo_status = 'O'"
and not
ls_filter = "mbo_status = 'Open'"
Hope this helps..(and not completely missing the point)
Dave V.
Just can't get this to work. I know I'm doing some obvious thing wrong but can't find it. Code looks like this:
DataWindowChild child1
li_rtc = dw_detail.GetChild( "mbo_status", child1)
ls_status = dw_detail.describe("evaluate('lookupdisplay(mbo_status)',1)") //Just to see what's there
ls_filter = "mbo_status = Open"
li_rtc_set_filter = child1.setFilter(ls_filter)
li_rtc_filter = child1.Filter()
I always get a -1 on the SetFilter, so something not right here.
child1 is a dddw on the dw_detail object (master / detail window).
The column in dw_detail that the dddw is on is "mbo_status".
The display column in the dddw is "status_condition".
I'm running this code out of the RowFocusChanged event of the dw_master just to see if I can get it to work. All of the values display correctly in the debugger.
The overall idea is that if the selected row in the master (dw_master) has the value of "Open", then I want to set the value of the mbo_status column (which is in the detail dw_detail and which has a dddw control on it), to only display "Open or Closed".
The dddw is a two column window, key - numeric, and display value - character.
Remember that when dealing with the ItemChanged event on a datawindow the entry (data) made is not 'accepted' into the control until after the event had successfully completed. You may need to create a 'post itemchanged' event which is posted if a change is made to one of the columns which affects your dddw entries. In this new event you would do your filtering and etc...
James -
It would be helpful to see the code. If you can supply a small, example app that demonstrates the problem, we should be able to provide you with some help. Without it we are limited to making educated guesses.
Not sure how EditChanged event helps. The ItemChanged event works fine, just can't get the filter to work on the dddw. Editchanged seems like it would be overkill and inefficient - but if it works? Everything is working in ItemChanged now, just no filter success.
Can't seem to get the dddw contents to filter. I have four items, when focus changes (itemchanged event) I try to filter the dddw to only allow 1 selection option from then on. I use Getchild to get the dddw, then filter on the child. All codes are ok, I just never get the filter to work. Initially, I use the Describe("Evaluate('lookupdisplay(colmun_name)... to get the text of the dddw selected item. The value is "Open", I then set the filter to "Closed", or "column_name = 'Closed'", neither work.
Hi James;
Yes, just use GetChild() command to locate the pointer to the DDDW in question and then follow through with that DDDW Pointer using the SetFilter() & Filter () commands.
HTH
Regards ... Chris