Dropdown datawindow display column behavior versus filter - powerbuilder

I have a datawindow containing x number of rows. The first column -- which I'll call "employee" -- is a dropdown datawindow with a data column pointing to an employee ID field, and a display column pointing to an employee name field. When adding a row, this column is filled based on the user's dropdown selection. Additionally, a filter is applied to the employee column's DatawindowChild, so that the user may not select an employee who does not match the current filter.
The problem:
When the filter expression changes such that it no longer matches existing rows, the employee column can no longer reference a display value for the current employee ID, because the corresponding row is in the dropdown datawindow's filter buffer. The result is that the data value is displayed instead.
What would be a smart workaround?
Also, one additional thing to consider is that I can't apply a matching filter to the main datawindow, because one of the requirements is that all rows remain visible at all times.
Thanks in advance.
Edit: Powerbuilder 2017 R2.

try this out first Unfilter the Child datawindow and apply new filter every time.

So after trying every trick I could think of using filters and coming up short, I ended up settling on a messy solution that partially subverts datawindow behavior, but works.
I reasoned that the only way to fix display issues caused by a mismatch between selectable values in a dropdown datawindow and actual values entered into the column was to make sure that a mismatch can never actually occur.
I made a new employee dropdown datawindow column with both display and data columns pointing to the employee name field. The user selects an employee name, and the employee ID is then manually fetched from the datawindow child using Find and GetItemString where necessary. The result is that the dropdown datawindow is no longer able to manipulate data -- this now has to be done manually in code, -- but there are no visual changes to existing rows when modifying filter expressions.
ls_employee = dw_1.GetItemString(row, "employee") //Returns employee ID
ls_employee = dw_1.GetItemString(row, "employee") //Returns employee name
ls_employee = ldwc_employee.GetItemString(ldwc_employee.Find("employee_name = '" + ls_employee + "'", 1, ldwc_employee.RowCount()), "employee_id") //Find row number and fetch ID
Then, because the user isn't actually inserting PK/FK values into the table anymore, the employee ID has to be manually set on the old (hidden) employee ID column before calling update.
dw_1.SetItem(row, "employee_id", ls_employee)
I'm not completely happy with this solution since it makes using a dropdown datawindow ultimately pointless. It also fails to account for cases where the find can return the wrong row number if two employees happen to have the same first and last names, but that's acceptable in my case because those situations are extremely unlikely to ever occur.
So I'm not proud of it, but there it is anyway.


Selecting a flexible element in Selenium IDE

I'm having a problem in work, trying do this in Selenium IDE:
I need select a element in a list, but for this, I need identify it before. But there is some complications:
1) The table contains a lot of rows with differents products and this products receives an ID at the moment they are created, for example: if the classification is by creation order, the first element will receive an ID: xxxx-01-yyy, the second xxxx-02-yyy, etc... But this can change if the classification mode changes too. This row that represent a product contains lots of fields, and each field has a different ID too, having by commom the number of the position in the table.
2)The box that I need to click to select my element it is like a check box at the left side os the field with the name.
Anyone has an idea of how to do this?
Does a particular row in your product table has some text in one of the cells which is unique to the test case you are creating?
If this is the case see #paul trmbrth's answer on this page.
If not, share the excerpt of HTML of your table and the function you are using.

GWT (smartgwt) grid sort selected records top

I have a grid where the user can select records via checkbox in front of every record. Now I have a requirement to sort the records based on their selection, so that all selected records should be placed top, followed by the not selected ones.
Is there any standard function to achieve this? As an alternative I thought of saving the selection state as an attribute on every record and sort based on the attribute.
The code for the column is:
I try to describe the code I use as the affected code is deeply nested in our own framework classes.
gridRealmDt is a subclass of smartgwt ListGrid. In my Dialog a create an instance of the grid which creates an instance of a database bound datasource. When the dialog is loaded the records are fetched from the database and after that a registered an dataArrivedHandler where I select the records which match records from another table.
I tried to place the selection attribute in an extra field and use that for sortig before my other sort criteria, but this does not work. Here is the code for the field I am using.
ListGridField txtSelected = new ListGridField(SELECTED, "");
When I do not set the canSortClientOnly property the order by is sent to my database resulting in an error, as the table does not contain that field, so I set the property. Now I get following error
Removing field from the sort Specifier array because it specifies canSort Client Only: true and all data is not yet client-side.
I also tried to use a sortNormilizer on the Name field which is my main sort criteria, but the normalizer is called before the selection value is set to the record.
record.setAttribute(CARealmDS.SELECTED,selected ? "a" : "b");
I also cannnot find a way to call the normalizer when selection changes.
Currently we are using Smart GWT Version 6.0p.
I don't think there is any standard function. Just use grid store update. Place checked items first.

MS Access table list order is defaulted in subform

I have a subform with a table, where some fields are restricted to tables. The tables are sorted in the correct order, but when it is used in the subform, it is set to default sorting. I can't find the location of the correct place to set the sorting criteria. I tried using query instead of a table, but i could only sort either by ascending or descending (or nothing). All three options resultet in undesired order. Example of the phase being sorted as default despite the table settings:
As Gustav suggests, add another field to your t_Phase table, which will be the order you want this list to appear in the drop-down (make sure it is a number field):
Supply the numeric order:
In your other table, you can use the ID field from your t_Phase table by selecting it through the lookup wizard:
Move across the ID and the new "Order" field you just created:
Use the "Order" field as the field you want to use for sorting and make sure "Ascending" is selected:
Continue through the wizard:
Select the field that has the data you want to go in to the record of your table (I assume it's the ID field rather than the Order field, so make sure ID is selected):
Finish the lookup wizard and go in to Datasheet View on your table and check that the dropdown is now in numeric order. You've probably noticed a problem though as it is showing both the ID and the Order columns:
To hide the unnecessary Order column, go back in to Design View and click on your phase field to select it.
At the bottom should be a "Lookup" tab. Click on this and notice the Column Widths property... it's showing 2 different widths values; the first one is the ID field and the second one is the Order field. Set the Order field to 0cm to hide it. I'd then recommend setting the remaining Id field width to something that will be wide enough to show all your ID field's options. Then I'd set the List Width property to the same width.
8cm, for example:
This should result in something like the following, which is hopefully what you're after.
If you're not adding a lookup field to the design structure of a table, but are instead using a combo-box on a form or subform, the principle is pretty much the same; you'll just have to amend the combo-box properties from the form's Property Sheet "Format" tab instead:
Combo- and listboxes always contain text, thus your column is not sorted numeric.
To have a numeric sort, add a column with the number only and - in the source - sort only on that. If you don't the number separately, create it from this expression:
Val(Mid([PhaseField], 7))

powerbuilder datawindow update error

I am trying to insert a new record but sometimes datawindow not includes all the column .
All columns are selected in the update properties but i am not getting all the columns in the insert statement.
The DataWindow isn't going to always include all columns in an INSERT statement that it generates. A column's inclusion on a given row is going to depend on that item's status that the DataWindow maintains. If the DataWindow sees that column as DataModified!, the column will be included in the INSERT. This way, it's not generating and sending unnecessary SQL.
The natural ways that a column's status will be set to DataModified! include data entry by the user, and if the column has an Initial value set in the DataWindow and another column has been data entered. (i.e. columns with Initial values are automatically set to DataModified!, but only after another column has been set to DataModified!). The synthetic way you can set a column to DataModified! is programmatically with the SetItemStatus() function. (Just be warned that I've often see people try to use this function, and they end up with unintended consequences; you need to carefully think through all the possibilities when using this function and test thoroughly.)
If there are still unexplained holes in your application's behaviour, I'd set a breakpoint in the SQLPreview event of the DataWindow and explore the columns' values, original value and item statuses. Looking at these three values will pretty much always explain the generated SQL. Explaining how these values got to their current state... often requires more digging.
Good luck,
Are you perhaps not calling accepttext() before the update?

DataWindow select group row

I have several datawindows with different looks. One simple just has a detail band and shows information. I can select rows in that datawindow, which marks that row. I got another DW that has a groupband with all the columns in it, and for some reason I can't select rows in that one.
I've also noticed that for example in itemfocuschanged(...) the dwobject argument is null for the DW with the group band. How do I solve this so also can select rows in my other DW?
All of the really nice easy to use functions depend on you using the detail band.
Otherwise, you'll need to parse the return value of GetBandAtPointer Function.
This will allow you to get the first detail row which informs your group row.
Here is an example from some of my code:
// Get Info from Header
band = dw_unbillables.GetBandAtPointer()
// Get the first row referred to by the header
li_cur_row = Integer(Mid(band,Pos(band, "~t")+1))
From Help:
Return value
Returns a string that names the band in which the pointer is located, followed by a tab character and the number of the row associated with the band (see the table in Usage). Returns the empty string (" ") if an error occurs.
If dwcontrol is null, the method returns null.
Search the help for GetBandAtPointer for full details.