Delphi.FastReport. Batch and unbatch reports. Buggy way on concat

Although in docs there is a sample of concating reports – it is a buggy way for some reasons…

Problem 1

i’ve already posted that function that concat reports but it well concats dynamically generated reports, if one of them in design time than it concats it unprepared i.e. empty and that is the problem for the moment

Problem 2

After concat i wanted to save it lets say in blob…  using savetofile() function, but ! Concated report doesn’t work well also… So i decided to batch reports by streams…

Unbatch reports…

Conclusion is concating reports – buggy way…

Posted in Delphi | Leave a comment

Delphi. FireDAC. BLOB

Example from project

shows writing in parent table and blob table

Theory from Embarcadero site

Embarcadero

The BLOB streaming technique implements BLOB parameter values streaming to / from a database. This allows to transfer a BLOB value “by reference” in contrast to transferring a BLOB value “by value”. The pros of this technique are: Continue reading

Posted in Delphi | Leave a comment

Delphi. FireDAC. FastReport. MasterDetail. Example from project

qSelectEventUsers – 1st query

Note: we use UsersID, eventsID as field alias

setup DataSource

qSelectEventUsersElements – 2d query

Note: we use UsersID, eventsID as param

setup 2-d query

setup FastReport components

frxDBDataset_qSelectEventUsers

DataSet:=DS_EventUsers

UserName:=frxDBDataset_qSelectEventUsers

frxDBDataset_qEventUserElements

DataSet:=qSelectEventUsersElements

UserName:=frxDBDataset_qEventUserElements

In frxReport enable DataSets and use fields…

Posted in Delphi | Leave a comment

Delphi. VCL. FastReport. Manual

https://www.fastreport.ru/public_download/docs/vcl/UserManual-ru.pdf

Posted in Delphi | Leave a comment

Delphi. FireDAC. MasterDetail

Source. Embarcadero

To set up a master-detail relationship, this sample uses the Object Inspector to configure the following components at design time as follows:

  • Two TFDQuery objects named qryOrders and qryOrderDetails. These components are used to implement a dataset capable of executing SQL queries. The following setup is needed:
  • Configure the Connection property of both components to specify the FireDAC connection object that is used to connect to a DBMS.
In order to set up a master-detail relationship, the SQL properties of both components have to be set up using the Object Inspector at design time as follows:

  • The SQL property of qryOrders is set to select * from {id Orders} in order to select “Order” records.
  • The SQL property of qryOrderDetails is set to select * from {id Order Details} where OrderID = :OrderID in order to select “Order Details” records.
Finally, both objects are linked in a master-detail relationship, where qryOrders is the master dataset and qryOrderDetails is the detail dataset. To this end, you have to set up the following properties of qryOrderDetails:

  • MasterFields is set to ORDERID.
  • IndexFieldNames is set to ORDERID.
  • MasterSource is set to dsOrders.
  • Two TDataSource objects named dsOrders and dsOrdDetails. These components provide an interface between a dataset component and data-aware controls on a form. In this sample, it is used to provide communication between the datasets and the grids where the datasets are displayed. To this end, the following properties are set up at design time using the Object Inspector:
  • The DataSet property of dsOrders is set to qryOrders and the DataSource property of DBGrid2 is set to dsOrder.
  • The DataSet property of dsOrderDetails is set to qryOrderDetails and the DataSource property of DBGrid1 is set to dsOrderDetails.

When you run the application, click on the Use Connection Definition combo box and select an option in order to define a connection. When you select an item of the combo box, the sample uses the Open method of qryOrders and qryOrderDetails in order to execute the SQL statements that retrieves the corresponding datasets from the database. Then, the sample displays the master and the detail datasets using a two TDBGrid components. The DBGrid2 is used to display and manipulate records from the master dataset, while the DBGrid1 is used to display and manipulate records from the detail dataset. Once the grids are filled, you can interact with the Cache details check box and the Refresh master and Refresh details buttons. These components have events attached to them to do the following:

  • The Cache details check box includes fiDetails into the FetchOptions.Cache property of qryOrderDetails if the check box is checked. It means that if it is checked, the associated detail record will not be discarded from the memory after changing a master dataset record.
  • The Refresh master button uses the Refresh method to re-fetch the master data from the database.
  • The Refresh details button uses the Refresh method to re-fetch the detail data from the database.
Posted in Delphi | Leave a comment

Delphi. MVC pattern in UniGUI vs traditional coding to form

My discussion on forum

Conclusion – mvc is possible to implement, but not obligatory. Standart delphi structure of dfm and pas is natural to delphi enviroment.

Maybe mvc pattern would be better for big projects…

Posted in Delphi, UniGui | Leave a comment

Delphi. UniGUI. Calc, just calc

Wanted to show 2 patterns on calc example, but calc itself has become not simple task…

Below version that works correctly but there is things to do…

 

Posted in Delphi, UniGui | Leave a comment

MySQL. function to count ratio. Example from project

Was needed to count progress of finished / all elements,below is an example how to do this…

 

Posted in Delphi | Leave a comment

Delphi. FireMonkeyStyles

 

Posted in Delphi, FireMonkey | Leave a comment

Delphi. FastReportVCL – merge / concat many reports

I needed report from runtime and disign time to be merged, so below is simpliest way to do this…

example of use

 

Building a composite report (batch printing)
In some cases it is required to organize printing of several reports at once, or
capsulate and present several reports in one preview window. To perform this, there are
tools in FastReport, which allow building a new report in addition to an already existing
one. The «TfrxReport.PrepareReport» method has the optional «ClearLastReport»
Boolean parameter, which is equal to «True» by default. This parameter defines whether it
is necessary to clear pages of the previously built report. The following code shows how to
build a batch from two reports:
frxReport1.LoadFromFile(‘1.fr3’);
frxReport1.PrepareReport;
frxReport1.LoadFromFile(‘2.fr3’);
frxReport1.PrepareReport(False);
frxReport1.ShowPreparedReport;
We load the first report and build it without displaying. Then we load the second
one into the same «TfrxReport» object and build it with the «ClearLastReport» parameter,
equal to «False». This allows the second report to be added to the one previously built.
After that, we display a finished report in the preview window.

Posted in Delphi, FastReport | Leave a comment