1. Check whether the database product you are using has a built-in function that can convert the date. If it does, then you could use the Query designer to add a calculated field to the SQL.
2. The other option is handle this on the report layout side of things. Delphi has a function called WeekOfTheYear that can convert a TDateTime to the week of the year. You could use a TppVariable component, set the datatype to dtInteger, and implement the OnCalc event using either Delphi code or RAP code.
example:
Value := WeekOfTheYear(myPipeline['SalesDate']);
Note: To call the WeekOfTheYear function from RAP code will require that you code a RAP pass-thru function and register it with the RAP code toolbox. See the following article for details....
There are two very simple and powerful techniques to extend the capabilities of RAP infinitely. These are summarized below and covered in more detail in the RAP.hlp online help. Demos and tutorials are installed to RBuilder\Demos\RAP. The tutorial text is located in RAP.hlp.
1. RAP Pass-Through Functions
These are functions that appear in the Language tab of RAP's Code Toolbox. These functions are written in Delphi and can be called from RAP. RAP's pass-through function architecture enable's developers to add new built-in functions to RAP's code toolbox.
2. Extend RAP's RTTI
RAP's Run-time Type information defines what classes and properties can be accessed via RAP. By default the published properties of any class that is registered with Delphi's RegisterClass procedure is recognized by RAP. In addition many of the public properties and methods of ReportBuilder classes are exposed.
Comments
Options:
1. Check whether the database product you are using has a built-in function
that can convert the date. If it does, then you could use the Query designer
to add a calculated field to the SQL.
2. The other option is handle this on the report layout side of things.
Delphi has a function called WeekOfTheYear that can convert a TDateTime to
the week of the year. You could use a TppVariable component, set the
datatype to dtInteger, and implement the OnCalc event using either Delphi
code or RAP code.
example:
Value := WeekOfTheYear(myPipeline['SalesDate']);
Note: To call the WeekOfTheYear function from RAP code will require that you
code a RAP pass-thru function and register it with the RAP code toolbox. See
the following article for details....
--------------------------------------------------
Article: Extending RAP
---------------------------------------------------
There are two very simple and powerful techniques to extend the capabilities
of RAP infinitely. These are summarized below and covered in more detail in
the RAP.hlp online help. Demos and tutorials are installed to
RBuilder\Demos\RAP. The tutorial text is located in RAP.hlp.
1. RAP Pass-Through Functions
These are functions that appear in the Language tab of RAP's Code Toolbox.
These functions are written in Delphi and can be called from RAP. RAP's
pass-through function architecture enable's developers to add new built-in
functions to RAP's code toolbox.
2. Extend RAP's RTTI
RAP's Run-time Type information defines what classes and properties can be
accessed via RAP. By default the published properties of any class that is
registered with Delphi's RegisterClass procedure is recognized by RAP. In
addition many of the public properties and methods of ReportBuilder classes
are exposed.
--
Tech Support mailto:support@digital-metaphors.com
Digital Metaphors http://www.digital-metaphors.com
--
Nard Moseley
Digital Metaphors Corporation
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com