Reports: Difference between revisions

From nuBuilderForte
Jump to navigation Jump to search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Back to [[Documentation]]
= Introduction =
nuBuilder Forte can create PDF Reports from the data stored in its database tables.
nuBuilder Forte can create PDF Reports from the data stored in its database tables.


The fonts to be used in reports must be placed in <tt>tcpdf/fonts</tt> folder. The TCPDF library is in the '''webroot in v4''' and in '''<tt>libs</tt> folder in v4.5'''. The '''function nuFontList()''' in <tt>nucommon.php</tt> file is used to load some initial fonts hardcoded as Helvetica, Courier, Times and Symbol.


There are 3 things needed to create a Report.
There are 3 things needed to create a Report.
Line 6: Line 10:
# A Table containing data to be used by the Report.
# A Table containing data to be used by the Report.
# A Report designer to create the way this data is displayed.
# A Report designer to create the way this data is displayed.


These Reports will allow the user to do things like...
These Reports will allow the user to do things like...
Line 14: Line 17:
*Print graphs.
*Print graphs.


[https://forums.nubuilder.cloud/viewtopic.php?f=21&t=10754#p22950 Forum Post] informs that [https://github.com/nuBuilder/nuBuilder-4.5/commit/1eb0194fb82ca1c4b61176130cd5e0fc3b36c5ab v4.5 commit 323] ([https://github.com/apmuthu/nubuilder4/commit/d604ee100cf995339726df247c1876e26b2a3a62 v4]) added a new column '''pdf_code''' in the table '''pdf_temp'''. So when you call '''nuRunReportSave()''' to save a report, the report code is stored in the table too.


=Building a Report=
=Building a Report=
Line 37: Line 41:




The point of using a [[Procedure|Procedure ]] is to create a temporary table that can be manipulated before it is used by the Report.
The point of using a [[Procedures|Procedures]] is to create a temporary table that can be manipulated before it is used by the Report.


(If a nuTABLE or a nuSQL ''table'' is chosen, this temporary table is created automatically)
(If a nuTABLE or a nuSQL ''table'' is chosen, this temporary table is created automatically)




The temp table created must be called '''#TABLE_ID#'''. It is used in nuBuilder the same way as other [[Hash_Cookies|Hash Cookies]].
The temp table created must be called '''#TABLE_ID#'''.  
 
 
<source>
 
$s  = "
 
SELECT
    sta_last_name,
    sta_initials,
    sta_games,
    sta_runs,
    sta_captain,
    CONCAT(sta_last_name, ',', sta_initials) AS full_name,
    1 AS player


FROM
    stats


";
'''#TABLE_ID#''' simply gets replaced by the name of a temporary table, created by nuBuilder, that will be used by the Report.


nuRunQuery("CREATE TABLE #TABLE_ID# $s");


</source>
It works the same way as other [[Hash_Cookies|Hash Cookies]].




This Lookup contains all these types.


*All of the tables have 'nuTable' as their code.
  $s  = "
*All of the SQL records have 'nuSQL' as their code.
 
  SELECT
      sta_last_name,
      sta_initials,
      sta_games,
      sta_runs,
      sta_captain,
      CONCAT(sta_last_name, ',', sta_initials) AS full_name,
      1 AS player
 
  FROM
      stats
 
  ";
 
  nuRunQuery("CREATE TABLE #TABLE_ID# $s");


==Launch From==
==Launch From==

Latest revision as of 10:00, 29 January 2022

Back to Documentation

Introduction

nuBuilder Forte can create PDF Reports from the data stored in its database tables.

The fonts to be used in reports must be placed in tcpdf/fonts folder. The TCPDF library is in the webroot in v4 and in libs folder in v4.5. The function nuFontList() in nucommon.php file is used to load some initial fonts hardcoded as Helvetica, Courier, Times and Symbol.

There are 3 things needed to create a Report.

  1. An Edit or Launch Form that contains values used by the Report eg From Date and To Date.
  2. A Table containing data to be used by the Report.
  3. A Report designer to create the way this data is displayed.

These Reports will allow the user to do things like...

  • Share information with others.
  • Help make business decisions.
  • Create invoices.
  • Print graphs.

Forum Post informs that v4.5 commit 323 (v4) added a new column pdf_code in the table pdf_temp. So when you call nuRunReportSave() to save a report, the report code is stored in the table too.

Building a Report

Code

A unique code for this Report

Description

The description of this Report

Group

A field that can be used to help organise Reports.

Table

A Table can be created in 3 different ways.

  1. A single table. - (nuTABLE)
  2. An SQL statement created with the SQL Builder. - (nuSQL)
  3. A PHP Procedure.

A Procedure will only appear in this list if #TABLE_ID# is found somewhere within it.


The point of using a Procedures is to create a temporary table that can be manipulated before it is used by the Report.

(If a nuTABLE or a nuSQL table is chosen, this temporary table is created automatically)


The temp table created must be called #TABLE_ID#.


#TABLE_ID# simply gets replaced by the name of a temporary table, created by nuBuilder, that will be used by the Report.


It works the same way as other Hash Cookies.


  $s  = "
  
  SELECT
     sta_last_name,
     sta_initials,
     sta_games,
     sta_runs,
     sta_captain,
     CONCAT(sta_last_name, ',', sta_initials) AS full_name,
     1 AS player
  
  FROM
     stats
  
  ";
  
  nuRunQuery("CREATE TABLE #TABLE_ID# $s");

Launch From

A Launch Form will allow..

  • The user to define the information to be stored in the table that will be used by the report.
  • Run the Report from an Action Button at the top of the Form.

Report Designer

nuBuilder Forte has its own Report Designer.

Running A Report

There are 2 ways to launch a Report.

  1. Click the Run Report Button on the Setup Tab of the Home Form.
  2. Create a Button with a custom click event using nuRunReport().