Michael Virdis
Michael Virdis

Reputation: 3

Delphi - MyDAC - Fast Report

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.

Upvotes: 0

Views: 396

Answers (2)

Daniel
Daniel

Reputation: 426

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

Upvotes: 0

gpi
gpi

Reputation: 544

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

Upvotes: 0

Related Questions