Recent Changes - Search:

ProReports

edit SideBar

Respect my work!
If you are using commercially
ProReports please
bay a license:

or

        BTC: 

1MTFbBSKrocPK7G6GKfG8RoTw5N57WnnNa

If you have paid donate send me e-mail with Your data or transaction number to receive an access code to articles with limited access.

Example of Internal XLS report

Download file TESTXLS.prs, if you want to import
example of a report to your instance of ProReports

We want to create report that basing on internal ProReports database will generate file *.xls containing several columns with user data. Example uses plugin xlsrep.php which will greatly help in creating files for MS Excel.

At first we have to register report using prepared earlier form named LOGIN. When registering from plugin list (Other files) we choose plugin xlsrep.php:

Next we need to register elements of a report:

  • element A
SectionValue
SymbolA
TypeHEAD
Weight0
Master element---
Descriptiondefining header of XLS report - sheet users
SQL 
Expression/Code beforeTemplate
$V[xls]=f_InitHeadRepXLS("users");
$V[xls].=f_AddColumnRepXLS(array("80","100","100","100","60","80"));
$V[xls].=f_AddHeadRepXLS(array(
"Login"=>"String",
"Name"=>"String",
"Surname"=>"String",
"City"=>"String",
"Number"=>"String",
"Amount"=>"String"
));
Template
$V[xls]
Expression/Code after Template 

When registering elements is good practice to use enlarged edit window (icon ), where available are following tools snippets/helpers that make it easier to fill every section of element:

Clicking on selected element will input linked with elements text fragment in edit window in place pointed by cursor. Thanks to that we speed up process of creating a report, because there no need to memorize functions available in plugin and parameters linked with it.

  • element B
SectionValue
SymbolB
TypeBODY
Weight1
Master element---
DescriptionSQL selecting data
SQLSELECT *,length(forename) number,length(forename)*0.34 amount FROM ge_users WHERE login like "$P[Login]"
Expression/Code before Template
$V[xls]=f_AddRowRepXLS(array(
array("$F[B_login]","String"),
array("$F[B_name]","String"),
array("$F[B_surname]","String"),
array("$F[B_city]","String"),
array("$F[B_number]","Number"),
array("$F[B_amount]","Currency"))
);
Template
$V[xls]
Expression/Code after Template 
  • element C
SectionValue
SymbolC
TypeFOOT
Weight2
Master element---
DescriptionSpreadsheet end
SQL
Expression/Code before Template
$V[xls]=f_FootRepXLS();
Template
$V[xls]
Expression/Code after Template 

After compiling report we can run it by selecting from menu option Execute:

Before generating report the form linked with it will be shown:

Using button Generate begins report generation process which end in creating *.xls file.


This page may have a more recent version on pmwiki.org: PmWiki:RepInternalXLS, and a talk page: PmWiki:RepInternalXLS-Talk.

Edit - History - Print - Recent Changes - Search
Page last modified on August 28, 2019, at 11:04 PM EST