{"id":361,"date":"2010-09-17T20:20:37","date_gmt":"2010-09-18T01:20:37","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=361"},"modified":"2021-03-09T10:12:45","modified_gmt":"2021-03-09T15:12:45","slug":"powerbuilder-gotcha-datawindow-update-properties","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-gotcha-datawindow-update-properties\/","title":{"rendered":"PowerBuilder &#8216;Gotcha&#8217; &#8211; Datawindow update properties"},"content":{"rendered":"<p>So a customer is complaining that their data is &#8216;auto-magically&#8217; changing and there is &#8216;no way anyone here is doing it since I&#8217;m the only one who knows how&#8217;. Blah, blah, blah.<\/p>\n<p>Solution? &#8211; database trigger to log when something is changed on the specified table.<\/p>\n<p>Now you go to the datawindow object which handles the particular item in question and you look at the update properties and you see something like this:<\/p>\n<p><a href=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2021\/03\/dw-update-props.png\"><img loading=\"lazy\" class=\"size-medium wp-image-1822 aligncenter\" src=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2021\/03\/dw-update-props-300x224.png\" alt=\"\" width=\"300\" height=\"224\" srcset=\"https:\/\/anvil-of-time.com\/wp-content\/uploads\/2021\/03\/dw-update-props-300x224.png 300w, https:\/\/anvil-of-time.com\/wp-content\/uploads\/2021\/03\/dw-update-props-150x112.png 150w, https:\/\/anvil-of-time.com\/wp-content\/uploads\/2021\/03\/dw-update-props.png 452w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Notice the Key Modification group box has &#8216;Use Delete then Insert&#8217; as the option. Now you think that this means that Powerbuilder is going to issue a delete and then an insert statement whenever the table is modified so you go off and write a delete trigger to watch for changes in code or description. Here&#8217;s the rub. The &#8216;Unique Key Column(s) values determine when the delete\/insert is performed. In the example, a change to the taskcode would not trigger a delete; it triggers an update. Make your trigger fire on an update and delete if you want to track such things.<\/p>\n<p>Good luck with your customer&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So a customer is complaining that their data is &#8216;auto-magically&#8217; changing and there is &#8216;no way anyone here is doing it since I&#8217;m the only one who knows how&#8217;. Blah, blah, blah. Solution? &#8211; database trigger to log when something is changed on the specified table. Now you go to the datawindow object which handles&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[21,12],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/361"}],"collection":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/comments?post=361"}],"version-history":[{"count":11,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/361\/revisions"}],"predecessor-version":[{"id":1824,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/361\/revisions\/1824"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}