Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Variables

edited September 2013 in General
Is there a convenient way to use a single variable in multiple locations
of a multi-page report? My report needs to print the current year in 24
different locations.

Thanks.

Comments

  • edited October 2013
    Hi H,

    The easiest way to display the current year would be to place a
    TppSystemVariable inside your report and set its VarType to Date. Then
    modify the DisplayFormat to 'yyyy'.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2013
    Perfect! Thanks very much.

  • edited October 2013
    Guess I answered a little too quickly. I've just been told that the year
    displayed will be based on historical records, so I'm back to having to
    deal with a non-system variable. Do I just create 24 variables, ppYear1
    thru ppYear24 and make them all equal, or is there anything a little
    less brute force?

    Thanks again.
    -Howard

  • edited October 2013
    Hi H,

    I do not believe there is an easier way to go about this other than
    placing the number of text components you need and updating their values
    manually.

    One option to make the updating easier, would be to create a report
    object loop that updates all report components with a certain
    specification (perhaps "HistoricalYear" in the name). This could make
    writing the code to update the values of each year component easier.

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Layouts/Report_Object_Loop

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2013
    Another approach is to handle this from the data side. For example, create a
    JITPipeline and define a field called Year. Set JITPipeline.RecordCount to
    1. Implement the OnGetFieldValue to return to the year. Then for the report
    layout you can use DBTexts to connect to the JITPipeline Year field.


    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2013
    Nard and Nico,

    Thanks for the tips and suggestions. Both approaches sound manageable;
    Nard's maybe a little less complex. I'll give that a try first.

    Thanks again for the assistance.

    -Howard

This discussion has been closed.