How to read first or last or nth data record
Hi,
I've been using FastReport with reasonable success for several months now. Generally speaking, I use the band/s to run through a sequence of data as fetched by an SQL function and display data as expected. However I now have a requirement where I need to read data from a specific row of data from the records returned by the SQL function. How do I go about doing that, either in the memo field or in the script.
To better understand what I am trying to achieve, I will explain what I am doing. We have a Delphi program where users enter a data/time range and the report is then generated for that date range. As the data we are extracting is time series data, there is a date/time stamp in the data itself, and I wish to read the first and last dates/times and then display a memo field that states something like "START 1 Jan 2017 END 5 Feb 2017".
I know enough to write the script that generates text in the relevant memo field, but have no idea how to access the required data that has been imported into fastreport by the SQL query. The data is contained in <frxDB1."seqtime">. Note too that this is in the PageHeader field, so this band is currently not linked to the Masterdata, though the band below it is, and the data is available and present (working in the rest of the report). I'm only stating the obvious here to avoid confusion or responses where people may think I'm looking at an "empty" report with no data in it [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> Your help is appreciated, thanks.[/img]
I've been using FastReport with reasonable success for several months now. Generally speaking, I use the band/s to run through a sequence of data as fetched by an SQL function and display data as expected. However I now have a requirement where I need to read data from a specific row of data from the records returned by the SQL function. How do I go about doing that, either in the memo field or in the script.
To better understand what I am trying to achieve, I will explain what I am doing. We have a Delphi program where users enter a data/time range and the report is then generated for that date range. As the data we are extracting is time series data, there is a date/time stamp in the data itself, and I wish to read the first and last dates/times and then display a memo field that states something like "START 1 Jan 2017 END 5 Feb 2017".
I know enough to write the script that generates text in the relevant memo field, but have no idea how to access the required data that has been imported into fastreport by the SQL query. The data is contained in <frxDB1."seqtime">. Note too that this is in the PageHeader field, so this band is currently not linked to the Masterdata, though the band below it is, and the data is available and present (working in the rest of the report). I'm only stating the obvious here to avoid confusion or responses where people may think I'm looking at an "empty" report with no data in it [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> Your help is appreciated, thanks.[/img]
Comments
store field value in another variable then move dataset back to first record
Sorry, but what is onstaet, and where do I find it. Is this something I set as script code (as a variable) or elsewhere?
Another thought, is can I determine which record FastReport is presently processing (when generating a report)? For example, I know I can use <Line> to determine the line number presently being worked on in a report, but could I write some script that looks something like:
if <Record> = 1 then DateVar = <frxDB."date">; // for first date record
or
if <Record> = <Record.Count> then DateVar = <frxDB."date">; // For last date record