Delphi - MyDAC - Fast Report

378 views Asked by At

I have no problem generating a report from a MySQL query or table. The problem starts when I want to add a variable in the report in each row.

For example, table "PRODUCTS": ID|PRODUCT-NAME|SHELF-LIFE

What's the best practice if I want to generate a report that shows me

ID | NAME | EXPIRE-DAY

Where: EXPIRE-DAY = TODAY + SHELF-LIFE

Thanks in advance for your help, even a link would be greatly appreciate.

2

There are 2 answers

1
Daniel On BEST ANSWER

Three Options:

  1. Use FR-functions to add your days.
  2. Use a variable in FR and calculate in Delphi via .OnGetValue-event
  3. Add the calculation of EXPIRE-DAY to your MySQL-Query

something like:

Select ID, NAME, SHELF-LIFE, DATE_ADD( CURDATE(), INTERVAL SHELF-LIFE DAY) as EXPIRE-DAY from mytable
5
gpi On

You may use FR's internal function DATE to get current date: [Date + <YourDatasetName."SHELF-LIFE">]