{"id":322,"date":"2010-08-30T20:20:37","date_gmt":"2010-08-31T01:20:37","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=322"},"modified":"2021-03-09T08:11:38","modified_gmt":"2021-03-09T13:11:38","slug":"powerbuilder-gotcha-datawindow-datasource-values","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-gotcha-datawindow-datasource-values\/","title":{"rendered":"PowerBuilder &#8216;Gotcha&#8217; &#8211; Datawindow datasource values"},"content":{"rendered":"<p>Let&#8217;s say you get a request to add some &#8216;audit&#8217; capability to your application.  By audit I mean there is a need to track changes made to various data elements on a record when they are saved back to the database.  This can be done any number of ways but you want to make use of the datawindow &#8216;datasource&#8217; property via dot notation.<\/p>\n<pre name=\"code\" class=\"VB\">ls_orig = dw_items.object.itemDesc.original[ll_row] \/\/ values retrieved from database\nls_new = dw_items.object.itemDesc[ll_row] \/\/ current values<\/pre>\n<p>Now if the values differ you do whatever you need to do.<\/p>\n<p>You test your code on a few columns in the datawindow, things look good, you check it in, it goes to QA and TA DA &#8211; rejected.<\/p>\n<p>The auditor states that some of the changed columns were changed but your audit list\/report incorrectly lists them.<br \/>\nExample shows:  Original Value: Blue Widget\t\tNew Value: Blue Widget<br \/>\nThe data is correct in the application.  The auditor changed the value from Blue Widget to Red Widget.<\/p>\n<p>The problem is the item description field on your datawindow object is populated from a dropdown datawindow.  To get the proper value you need to:<\/p>\n<pre name=\"code\" class=\"VB\">ls_describe = &quot;Evaluate(&#039;LookUpDisplay(partId)&#039;, &quot; + string(ll_row) + &quot;)&quot;\nls_new = dw_items.Describe(ls_describe)<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Let&#8217;s say you get a request to add some &#8216;audit&#8217; capability to your application. By audit I mean there is a need to track changes made to various data elements on a record when they are saved back to the database. This can be done any number of ways but you want to make use&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\/322"}],"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=322"}],"version-history":[{"count":7,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/322\/revisions"}],"predecessor-version":[{"id":1805,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/322\/revisions\/1805"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}