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 ordered by index.1 Set Main_File to CUST.file_number Set ordering to 1 Object oPageHeader is a cszVpePageHeaderSection Set psPageTitle to "StarZen Technologies, Inc" Set psPageSubtitle to "Column Report Sample V2" Set piSectionHeight to 150 End_Object End_Object
We create a simple object based on the cszVpeColumnReport class
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
In our example we will add constraints directly to the report object as well as a manual selection function
// Constraint Procedure OnConstrain String sIDTo sIDFrom Get Value of oSelStart1 to sIDFrom Get Value of oSelStop1 to sIDTo Constrain CUST.NUM ge sIDFrom If (trim(sIDTo)<>"") Constrain CUST.nUm ge sIDTo End_Procedure // use manual selection Function Selection Returns Integer Send DoUpdateStatusPanel ("Processing record#: "+String(CUST.NUM)) Function_Return RPT_OK End_Function
the report class also has a built in status panel feature and we are updating the status panel from the selection function
Now on to define the columns. this works very similar to the way you define columns in dbgrids and dblists
Object oIDColumn is a cszVpeReportColumn Set psCaption to "ID" Set piWidth to 8 Function ColumnValue Returns String Function_Return (trim(CUST.NUM)) End_Function End_Object Object oNameColumn is a cszVpeReportColumn Set psCaption to "Name" Set piWidth to 20 Function ColumnValue Returns String Function_Return (trim(CUST.NAME)) End_Function End_Object Object oAddressColumn is a cszVpeReportColumn Set psCaption to "Address" Set piWidth to 20 Function ColumnValue Returns String Function_Return (trim(CUST.ADDRESS1)) End_Function End_Object Object oCityColumn is a cszVpeReportColumn Set psCaption to "City" Set piWidth to 12 Function ColumnValue Returns String Function_Return (trim(CUST.CITY)) End_Function End_Object Object oBalanceColumn is a cszVpeReportColumn Set psCaption to "Balance" Set piWidth to 18 Set piTextAlignment to VPE_ALIGN_RIGHT Set pbTotal to True Set pnTotalFormat to 8.2 Set pbTotalThousandsFormatting to True Function ColumnValue Returns String Function_Return (szFormatToDecimalsEx(cust.balance,10.2,True)) End_Function End_Object
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
we can also define other sections for example a page header section
Object oPageHeader is a cszVpePageHeaderSection Set psPageTitle to "StarZen Technologies, Inc" Set psPageSubtitle to "Column Report Sample V2" Set piSectionHeight to 150 End_Object
this is pretty much all there is to creating a simple column report
These VPE reports can be used in both DataFlex Desktop as well as WebApp applications