-
Ricardo Jasso
- PowerBuilder
- Monday, 11 March 2019 04:10 PM UTC
Hi All,
Recently, I changed my practice of using "Key and Updatable Columns" to "Key and Modified Columns" in the "Where Clause for Update/Delete" of capture datawindows. My reasoning was that for my purposes it was not necessary to include all updatable columns in the where clause, just the ones that where modified.
But since the data source of the datawindow includes more tables than just the one that will ultimately get updated, PowerBuilder included columns from the other tables in the where clause of the update command that where modified. This resulted in an error from the database indicating that such columns where invalid. PowerBuilder should not have included those columns since they don't belong to the table that will be updated.
Why am I including more tables in the data source? Because those tables are reference tables to get values like the customer name whereas in the updatable table there is only customer key. This allows me to use the same datawindow both for adding new records and retrieving existing ones. The only caveat is that when adding new records code must be written to look up the information of a reference table when the key has been input. And to place such information in the columns that belong to the reference table but which are not part of the updatable table.
Is there a way that only the modified AND updatable columns be included in the where clause?
TIA,
Ricardo Jasso
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.