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.
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'.
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?
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.
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
Comments
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'.
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
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
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
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
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