Faisal -
I'm able to reproduce the issue using the follow command button Clicked event script in a test application using PB 2019 R2 Build 2353. Although the test app is connected to SQL Server 2017 with the SNC driver, the DataWindow and DataWindowChild being tested have their data saved internally to the data object and therefore do NOT issue any data retrieve calls.
Integer li_rc
Long ll_rows
String ls_desc, ls_modify, ls_result, ls_msg
DataWindowChild ldwc_state
ls_desc = String(dw_1.Describe("state.DDDW.Lines"))
ls_msg = 'Test 1: The "state" drop-down DataWindow list shows '+ls_desc+' lines.~r~n~r~n'
li_rc = dw_1.GetChild('state',ldwc_state)
If li_rc = 1 Then
ll_rows = ldwc_state.RowCount()
ls_msg += 'Test 2: The "state" DataWindowChild contains '+String(ll_rows)+' rows.~r~n~r~n'
ls_modify = "state.DDDW.Lines=25"
ls_result = dw_1.Modify(ls_modify)
ls_msg += 'Test 3: Modify command: "'+ls_modify+'"~r~n~r~nResult: "'+ls_result+'"'
If Not IsValid(ldwc_state) Then
ls_msg += 'Test 4: DataWindowChild reference is no longer valid.~r~n~r~n'
li_rc = dw_1.GetChild('state',ldwc_state)
If IsValid(ldwc_state) Then
ls_msg += 'Test 4a: DataWindowChild reference has been refreshed and is now valid.~r~n~r~n'
Else
ls_msg += 'Test 4a: DataWindowChild reference could not be refreshed. Exiting now.'
MessageBox('Child DataWindow Test Results',ls_msg)
Return 0
End If
Else
ls_msg += 'Test 4: DataWindowChild reference is still valid.~r~n~r~n'
End If
ls_desc = String(dw_1.Describe("state.DDDW.Lines"))
ls_msg += 'Test 5: The "state" drop-down DataWindow list shows '+ls_desc+' lines.~r~n~r~n'
If IsValid(ldwc_state) Then
ls_msg += 'Test 6: The DataWindowChild reference is still valid.~r~n~r~n'
Else
ls_msg += 'Test 6: The DataWindowChild reference is no longer valid.~r~n~r~n'
li_rc = dw_1.GetChild('state',ldwc_state)
If IsValid(ldwc_state) Then
ls_msg += 'Test 6a: DataWindowChild reference has been refreshed and is now valid.~r~n~r~n'
Else
ls_msg += 'Test 6a: DataWindowChild reference could not be refreshed. Exiting now.'
MessageBox('Child DataWindow Test Result',ls_msg)
Return 0
End If
End If
ll_rows = ldwc_state.RowCount()
ls_msg += 'Test 7: The "state" DataWindowChild contains '+String(ll_rows)+' rows.~r~n~r~n'
li_rc = dw_1.GetChild('state',ldwc_state)
ls_msg += 'Test 8: GetChild issued RC = '+String(li_rc)+'~r~n~r~n'
ll_rows = ldwc_state.RowCount()
ls_msg += 'Test 9: The "state" DataWindowChild contains '+String(ll_rows)+' rows.'
End If
MessageBox('Child DataWindow Test Results',ls_msg)
Return 0
Here are the results when executed from within the PB IDE:
You can see in the line labeled "Test 7" that the RowCount() PowerScript function executed against the valid DataWindowChild reference incorrectly returns a count of zero rows.
By simply refreshing the reference to the DataWindowChild by using the GetChild() function, the abnormality clears up. At no point are the rows in the child DataWindow actually "gone"... if I return from the script immediately after testing the "Test 7" condition, the drop-down opens and displays the information in the child DataWindow with the proper number of rows displayed. The behavior is the same for a variety of DDDW Lines values.
I'm actually surprised the reference to the DataWindowChild remains valid (supposedly) after altering the Lines property, for I expected this action to invalidate the object. As a matter of practice, I always perform another GetChild after altering any DDDW property - and as we see here, this does seem to address the issue.
I suppose you could open a Bug Report on this issue, but with such a simple workaround available, I really don't see the point in doing so.
HTH
Regards, John
Here we go
1) PB 2019 R2 Build 2353
2) Both
3) Yes because recently we implemented modify to increase dddw_nooflines at run time for better usability
4) Windows 10 Enterprise Version 1809 Build17763.1637
5) Yes
Kind Regards
Faisal