{"id":637,"date":"2018-11-16T05:38:04","date_gmt":"2018-11-16T10:38:04","guid":{"rendered":"http:\/\/salzlechner.com\/dev\/?p=637"},"modified":"2018-11-16T05:38:04","modified_gmt":"2018-11-16T10:38:04","slug":"creating-a-simple-column-report-with-vpe","status":"publish","type":"post","link":"http:\/\/salzlechner.com\/dev\/2018\/11\/16\/creating-a-simple-column-report-with-vpe\/","title":{"rendered":"Creating a simple column report with VPE"},"content":{"rendered":"<p>Even though there is no designer for VPE reports especially column based reports can be created very quickly and can also be maintained rather easily<\/p>\n<p>as an example lets walk through creating a simple customer report<\/p>\n<p>the skeleton for a report object looks as follows<\/p>\n<pre class=\"lang:default decode:true\">Object oColumnReport is a cszVpeColumnReport_V2\r\n    \/\/ main file is CUST ordered by index.1\r\n    Set Main_File to CUST.file_number\r\n    Set ordering to 1\r\n\r\n    Object oPageHeader is a cszVpePageHeaderSection\r\n            Set psPageTitle to \"StarZen Technologies, Inc\"\r\n            Set psPageSubtitle to \"Column Report Sample V2\"\r\n            Set piSectionHeight to 150\r\n    End_Object\r\n        \r\nEnd_Object<\/pre>\n<p>We create a simple object based on the cszVpeColumnReport class<\/p>\n<p>We can set the main file and the ordering. The report class can either support database finds and constraints directly or via an attached DataDictionary object<\/p>\n<p>In our example we will add constraints directly to the report object as well as a manual selection function<\/p>\n<pre class=\"lang:default decode:true\">    \/\/ Constraint    \r\n    Procedure OnConstrain\r\n        String sIDTo sIDFrom\r\n        \r\n        Get Value of oSelStart1 to sIDFrom\r\n        Get Value of oSelStop1 to sIDTo\r\n        \r\n        Constrain CUST.NUM ge sIDFrom\r\n        If (trim(sIDTo)&lt;&gt;\"\") Constrain CUST.nUm ge sIDTo            \r\n    End_Procedure\r\n    \r\n    \/\/ use manual selection\r\n    Function Selection Returns Integer\r\n        Send DoUpdateStatusPanel (\"Processing record#: \"+String(CUST.NUM))\r\n    \r\n        Function_Return RPT_OK\r\n    End_Function<\/pre>\n<p>the report class also has a built in status panel feature and we are updating the status panel from the selection function<\/p>\n<p>Now on to define the columns. this works very similar to the way you define columns in dbgrids and dblists<\/p>\n<pre class=\"lang:default decode:true \">Object oIDColumn is a cszVpeReportColumn \r\n  Set psCaption to \"ID\"\r\n  Set piWidth to 8\r\n                \r\n  Function ColumnValue Returns String\r\n    Function_Return (trim(CUST.NUM))\r\n  End_Function \r\nEnd_Object\r\n        \r\nObject oNameColumn is a cszVpeReportColumn \r\n  Set psCaption to \"Name\"\r\n  Set piWidth to 20\r\n                \r\n  Function ColumnValue Returns String\r\n    Function_Return (trim(CUST.NAME))\r\n  End_Function \r\nEnd_Object\r\n\r\nObject oAddressColumn is a cszVpeReportColumn \r\n  Set psCaption to \"Address\"\r\n  Set piWidth to 20\r\n                \r\n  Function ColumnValue Returns String\r\n    Function_Return (trim(CUST.ADDRESS1))\r\n  End_Function \r\nEnd_Object\r\n\r\nObject oCityColumn is a cszVpeReportColumn \r\n  Set psCaption to \"City\"\r\n  Set piWidth to 12\r\n                \r\n  Function ColumnValue Returns String\r\n    Function_Return (trim(CUST.CITY))\r\n  End_Function \r\nEnd_Object\r\n\r\nObject oBalanceColumn is a cszVpeReportColumn \r\n  Set psCaption to \"Balance\"\r\n  Set piWidth to 18\r\n  Set piTextAlignment to VPE_ALIGN_RIGHT\r\n  Set pbTotal to True\r\n  Set pnTotalFormat to 8.2\r\n  Set pbTotalThousandsFormatting to True\r\n                \r\n  Function ColumnValue Returns String\r\n    Function_Return (szFormatToDecimalsEx(cust.balance,10.2,True))\r\n  End_Function \r\nEnd_Object\r\n<\/pre>\n<p>you simply define all the column objects setting properties. The report class supports hiding as well as reording columns at runtime and will adjust the report output automatically based on these changes<\/p>\n<p>we can also define other sections for example a page header section<\/p>\n<pre class=\"lang:default decode:true \">        Object oPageHeader is a cszVpePageHeaderSection\r\n                Set psPageTitle to \"StarZen Technologies, Inc\"\r\n                Set psPageSubtitle to \"Column Report Sample V2\"\r\n                Set piSectionHeight to 150\r\n        End_Object<\/pre>\n<p>this is pretty much all there is to creating a simple column report<\/p>\n<p>These VPE reports can be used in both DataFlex Desktop as well as WebApp applications<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Even though there is no designer for VPE reports especially column based reports can be created very quickly and can also be maintained rather easily as an example lets walk through creating a simple customer report the skeleton for a report object looks as follows Object oColumnReport is a cszVpeColumnReport_V2 \/\/ main file is CUST [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","ngg_post_thumbnail":0,"footnotes":""},"categories":[6,27,23],"tags":[],"class_list":["post-637","post","type-post","status-publish","format-standard","hentry","category-dataflex","category-dataflex-webapp","category-vpe-for-vdf"],"_links":{"self":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/637","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/comments?post=637"}],"version-history":[{"count":1,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/637\/revisions"}],"predecessor-version":[{"id":638,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/637\/revisions\/638"}],"wp:attachment":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/media?parent=637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/categories?post=637"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/tags?post=637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}