TRColumn

Source: source/classes/rcolumn.prg

Standalone class

TRColumn represents a single column within a TReport. It defines how data is retrieved, formatted, and displayed for each column in a printed report. Columns support totals, cumulative totals, memo fields, images, progress bars, and inline charts.

Key DATA Members

DATATypeDescription
oReportObjectParent TReport object this column belongs to
aDataArrayArray of codeblocks retrieving field values for each line
aTitleArrayColumn heading lines
aPictureArrayPicture clauses for formatting column data
nWidthNumericColumn width in report units
nTotalNumericRunning total accumulator
lTotalLogicalEnable column total display
lMemoLogicalTreat column as multi-line memo text
lImageLogicalTreat column as image display
lProgBarLogicalRender column as a progress bar
lCumTotalLogicalEnable cumulative running total
nAlignTitleNumericTitle text alignment
bDataFontCodeblockData font selector (returns font index)
bColorCodeblockConditional color codeblock
cChartStyleCharacterInline chart style ("BAR", "PIE", etc.)

Methods

MethodDescription
New( aTitle, nCol, aData, nSize, aPicture, bFont, lTotal, bTotalExpr, cFmt, lShadow, lGrid, nPen, oReport, lCumTotal )Create a new TRColumn instance
SayTitle( nRow, nCol, nLine )Render column title at the specified position
SayData( nRow, nCol, nLine )Render data value at the specified position
SayTotal( nRow, nCol )Render total value at the specified position
Stabilize( nOrder )Calculate column dimensions and prepare for rendering
LineCount()Return the number of lines this column occupies
DrawChart( oRect )Draw an inline chart (bar/pie) within the column area
DrawProgBar( oRect )Draw a progress bar within the column area
Separator( nRow, lForced )Draw a separator line at the given row

Example: Column with Total

#include "FiveWin.ch"
#include "report.ch"

function BuildReport()

   local oReport, oCol

   REPORT oReport TITLE "Sales Report" PREVIEW

   COLUMN oCol TITLE "Product" DATA { || oSale:Product }
   COLUMN oCol TITLE "Amount" ;
          DATA { || oSale:Amount } ;
          PICTURE "999,999.99" ;
          TOTAL

   END REPORT

   ACTIVATE REPORT oReport

return nil

Notes

See Also