{"id":751,"date":"2011-05-05T20:20:19","date_gmt":"2011-05-06T01:20:19","guid":{"rendered":"http:\/\/anvil-of-time.com\/wordpress\/?p=751"},"modified":"2021-03-10T20:11:25","modified_gmt":"2021-03-11T01:11:25","slug":"powerbuilder-gotcha-removing-blank-rows-from-datawindow","status":"publish","type":"post","link":"https:\/\/anvil-of-time.com\/powerbuilder\/powerbuilder-gotcha-removing-blank-rows-from-datawindow\/","title":{"rendered":"PowerBuilder &#8216;Gotcha&#8217; &#8211; Removing Blank Rows from Datawindow"},"content":{"rendered":"<p>I&#8217;m working with a &#8216;pre-Cambrian&#8217; framework of sorts which has a datawindow ancestor with quite a lot of functionality in it.  One standard piece in list type datawindows is to insert a blank row when the user opens a window.  This way the user doesn&#8217;t have to click a &#8216;new&#8217; button or do something else when they want to enter data.  This is fairly standard user centric functionality.<\/p>\n<p>Now if the user doesn&#8217;t do anything with the new row you need to make sure it isn&#8217;t going to generate an insert statement back to the database when the window is saved.  The framework has functionality for this as well and it checks the row status via a GetItemStatus call checking for a DWItemStaus of New!.  If it finds a row with this status it removes it from the primary buffer via a RowsDiscard call.  This is not needed since a row with a status of New! doesn&#8217;t generate any SQL to the database anyway.<\/p>\n<p>However, if the datawindow object has default values, after the insertrow the defaults are set and the DWItemStatus is now NewModified!.  You cannot directly set this back to New!; you must issue a SetItemStatus for the row and set the DWItemStatus to NotModified! which results in the row having a status of New!.  For more information see the PB help on SetItemStatus method (DataWindows).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m working with a &#8216;pre-Cambrian&#8217; framework of sorts which has a datawindow ancestor with quite a lot of functionality in it. One standard piece in list type datawindows is to insert a blank row when the user opens a window. This way the user doesn&#8217;t have to click a &#8216;new&#8217; button or do something else&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[21,12],"_links":{"self":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/751"}],"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=751"}],"version-history":[{"count":4,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/751\/revisions"}],"predecessor-version":[{"id":1943,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/posts\/751\/revisions\/1943"}],"wp:attachment":[{"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/media?parent=751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/categories?post=751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anvil-of-time.com\/wp-json\/wp\/v2\/tags?post=751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}