Use data from an array in a Report

2

I have an array like this that is being populated in runtime:

MatSort[0][0] - Nome1
MatSort[0][1] - InfoNome1
MatSort[1][0] - Nome2
MatSort[1][1] - InfoNome2

But I do not know how to reference the data in this array in fast-reports so that a report with the configuration is generated:

  

Name1 - InfoName1

     

Name2 - InfoName2

Remembering that the Name and Info data should be next to each other and the names separated by a line.

    
asked by anonymous 18.09.2017 / 19:31

1 answer

2

You can inject this data into the report. But it is easier and more practical in the report to work with datasets.

Why do not you populate a TClientDataSet (a dataset in memory that does not need to be connected to the DB) with the array data before you print the report, and do you use the report linked to that dataset?

There are several ways to do this but suggested something like:

  • Put TClientDataSet where you have fastreport (Form or Datamodule)
  • Create the Name fields; InfoNome in TClientDataSet
  • You do something like (being cds the name of the TClientDataSet)
  • for i:=0 to limiteMatriz-1 do - begin - cds.append; - cdsNome.value:=MatSort[i][0];

    Now you can link the datasource to the report (for this you can easily find documentation)

        
    19.09.2017 / 10:04