Hi,
I am trying to update an old PB app.
Background of the basic database structure:
my_data Table:
col1
col2 -- lookup to an_old_table.id
col3 -- newly added as lookup
my_new_lookup Table:
code -- 'linked' to col3 above
description
an_old_lookup table:
id -- 'linked' to my_data.col2
text
I have created a new lookup table in our oracle database, and added an extra column to an existing table this column matches the lookup code and we can pull the full description of the item from there.
I would like to add the new lookup table as a dropdown list in a window of my app.
There is already a dropdown list which does exactly this, displaying an_old_table.text in the dropdown but updating my_table.col2 with the id value.
I have attempted to duplicate this functionality exactly but with data from my_new_lookup to my_data.col3, but am failing somewhere.
I have created a new d_dddw_mynewdropdown, which in the preview window lists all my_new_lookup.description values from the database correctly.
In the datawindow, I added a column control, changed the edit to DropDownDW, making sure the DataWindow is d_dddw_mynewdropdown and display and data columns matched description and code respectively.
When I do a retreive on the datawindow within powerbuilder, with a record from the my_data table a dropdown box appears correctly in the preview window with the value matching the correct lookup description, so it is flowing through col3 > code > description correctly.
The datawindow is embedded into an application window, and this is where I think it is failing... The window has two datawindows on it and part of the open() function does:
If dw_one.Retrieve(ln_id,) > 0 Then ll_row = dw_one.GetRow()
If dw_one.ShareData (dw_two) <> 1 Then MessageBox ("Error", "Error in sharing data.") Else dw_two.ScrollToRow (ll_row) End If
Which passes (IE does not display the message box)
It then executes:
dw_one.InsertRow(0)
dw_two.InsertRow(0)
Which is where the application displays an error message which says:
Select Error: ORA-00942: table or view does not exist
I stepped through the code in debug mode and discovered the error message comes from the dw_one.InsertRow(0) line.
If I press ok to the error, the application continues to run, but the value of the dropdown box is my_data.col3 (the 'linking' code, not the full description) and the dropdown when pressed is empty.
I am not sure what I have done wrong.. In powerbuilder itself everything seems to be working and connecting together as it should when I preview the data in the datawindows, but something about the application window has issues.
Has anyone experienced similar things? I do not know where else to look to fix this.
Thanks.