BPS Script API  2.24.4
report Namespace Reference

The report is a static global object which exists only while processing a BPS report. More...

Classes

class  Item
 Report items can not be created by scripting, only existing items in a section can be used. More...
 
class  Page
 Report pages can only be created by report.addPage(). More...
 
class  Section
 Report sections can only be created by report.createSection(). More...
 

Functions

Page addPage ()
 Creates a new page and appends it to the end of the report. More...
 
Section createSection (String aName)
 Creates a new section with the properties of a named section element. More...
 
Page pageAt (Number aIndex)
 Get the existing page object at a certain index. More...
 
Number pageCount ()
 
Number printHeight ()
 
void setItemsCount (Number aCount)
 Starts the progress indicator and defines the number of steps until 100%. More...
 
void setLoadedItems (Number aPos)
 Updates the progress indicator to the given position. More...
 

Detailed Description

The report is a static global object which exists only while processing a BPS report.

There is only one static report object, you can not create new objects of this type.

A report definition is represented by three layers of elements:

  • The top level is the report object.
  • The middle layer (children of report) is a list of sections.
  • The bottom level (children of sections) is a list of items.

Property Matrix:

Not all property types are currently accessible by scripting, however what will work by now are BpsDatastore and simple types such as QString, bool, int, qreal and enums such as BarcodeType, Direction, Orientation, Papersize, Rotation etc.

NameType (C++ type, remarks)Reportsectionsimpletextrichtextlinerectangleellipsebarcodepixmap
alignmentbps.Alignment (Bps::Alignment)nonoyesnononononoyes
application [1]String (QString)yesnononononononono
autogrowBoolean (bool)noyesnonononononono
barcodetypebps.Barcode (Bps::Barcode)nononononononoyesno
brushbps.Brush (QBrush)nonoyesyesnoyesyesnono
colorbps.Color (QColor)nonoyesyesnononoyesno
data [1]Application dependent a simple value, an object or an arrayyesnononononononono
datastore [1]bps.Datastore (BpsDatastore)yesnononononononono
directionbps.Direction (Bps::Direction)nonoyesyesnononoyesno
emptyokBoolean (bool)yesnononononononono
fontbps.Font (QFont)nonoyesyesnononoyesno
heightNumber (qreal, mm)noyesnonononononono
marginsbps.Margins (BpsMargins, mm)yesnoyesyesnonononono
moduleNumber (qreal, mm)nononononononoyesno
nameString (QString)yesyesyesyesyesyesyesyesyes
orientationbps.PaperOrientation (QPrinter::Orientation)yesnononononononono
p1bps.Point (QPointF, mm)nonononoyesnononono
p2bps.Point (QPointF, mm)nonononoyesnononono
paperNumber (QPrinter::Papersize)yesnononononononono
papersizebps.Size (QSizeF, mm)yesnononononononono
penbps.Pen (QPen)nonoyesyesyesyesyesnono
pixmapbps.Pixmap (QPixmap)nonononononononoyes
posbps.Point (QPointF, mm)nonoyesyesnoyesyesyesyes
positionbps.VerticalAlignment (Bps::VerticalAlignment)noyesnonononononono
ppiNumber (int, points per inch)nonononononononoyes
rawcodec [2]String (QString)yesnononononononono
rawdata [2]String (QString)yesnononononononono
rotationbps.Rotation (Bps::Rotation)nonononononononoyes
roundedBoolean (bool)nonononoyesnononono
roundnessNumber (int, 0...100%)nonoyesyesnoyesnonono
scriptString (QString)yesnononononononono
selections [1]Object (QMap<QString,QVariantList>)yesnononononononono
sid [1]String (QString)yesnononononononono
sizebps.Size (QSizeF)nonoyesnonoyesyesyesyes
sizingbps.PixmapSizing (BpsGraphicsPixmapItem::Sizing)nonononononononoyes
spanAngleNumber (qreal, degree)nonononononoyesnono
startAngleNumber (qreal, degree)nonononononoyesnono
textString (QString)nonoyesyesnononoyesno
textprintedBoolean (bool)nononononononoyesno
title [1]String (QString)yesnononononononono
widthNumber (qreal, mm)nononoyesnonononono
zvalueNumber (int)nonoyesyesyesyesyesyesyes

[1] Dynamically applied at runtime before executing the report script:

  • Application is a unique name per application such as "designer", "articles", "partners" or "ordertrips" for example.
  • Title is taken from the current report settings (t_reportsettings.c_title). In the report designer it is the base filename instead.
  • Selection is an object with each property name being a table name, and holding an array of keys of currenty selected rows.
  • SID is unique per application and report setting, for example "ordertrips_57". It may be used as key to save and restore settings.

[2] Used to write directly to the printer, instead of preparing GDI content:

  • Rawdata is the data to send to the printer.
  • Rawcodec is the name of the codec used to encode the data. Default is ISO 8859-1 (Latin1). See QTextCodec for full list of available codecs. Example: "IBM 850".

Function Documentation

◆ addPage()

Page report::addPage ( )

Creates a new page and appends it to the end of the report.

Returns
Returns the created page object.

◆ createSection()

Section report::createSection ( String  aName)

Creates a new section with the properties of a named section element.

Note that the section is not automatically added to any page, that must be done by calling report.Page.appendSection() or report.Page.insertSection().

Parameters
[in]aNameThe section name.
Returns
Returns the created section object.
Exceptions
ErrorWhen no section element with this name is found.

◆ pageAt()

Page report::pageAt ( Number  aIndex)

Get the existing page object at a certain index.

Parameters
[in]aIndexThe page index, it must be in the range 0 ... pageCount()-1.
Returns
Returns the page object.
Exceptions
ErrorWhen invalid index provided.

◆ pageCount()

Number report::pageCount ( )
Returns
Number of pages in the report.

◆ printHeight()

Number report::printHeight ( )
Returns
The net available printing height on one page in millimeters.

◆ setItemsCount()

void report::setItemsCount ( Number  aCount)

Starts the progress indicator and defines the number of steps until 100%.

Parameters
aCountThe number of steps for the progress.

◆ setLoadedItems()

void report::setLoadedItems ( Number  aPos)

Updates the progress indicator to the given position.

Parameters
aPosThe position to set the progress arm to. Must be in range 0 ... aCount given in setItemsCount().