Using UDFlib Date Functions in External Applications
ReportSmith uses SQL statements for retreiving data from InterBase. You can
modify these statements to let InterBase and thereby ReportSmith use UDFlib
functions.
If we look at the employee.gdb database that comes with InterBase, there is a
table called orders. It contains orders and had date/time fields to indicate
when the order was placed. We now want to look at our date by quarters not days.
We will use the quarter function from UDFlib that converts dates into quarters
(i.e. 95Q1).
If you run ReportSmith and create a report with all of the colums from the
order table, ReportSmith will create an sql statement like:
SELECT
SALES.PO_NUMBER, SALES.CUST_NO, SALES.SALES_REP, SALES.ORDER_STATUS,
SALES.ORDER_DATE, SALES.SHIP_DATE, SALES.DATE_NEEDED, SALES.PAID, SALES.QTY_ORDERED,
SALES.TOTAL_VALUE, SALES.DISCOUNT, SALES.ITEM_TYPE, SALES.AGED
FROM
SALES
if we modify the SQL statement slightly:
SELECT
SALES.PO_NUMBER, SALES.CUST_NO, SALES.SALES_REP, SALES.ORDER_STATUS, Quarter(SALES.ORDER_DATE,1) , SALES.SHIP_DATE, SALES.DATE_NEEDED, SALES.PAID, SALES.QTY_ORDERED,
SALES.TOTAL_VALUE, SALES.DISCOUNT, SALES.ITEM_TYPE, SALES.AGED
FROM
SALES
using the UDF quarter function, we will get a column that contains the quarter
in which the transaction took place instead of the date. The actual values
would look similar to 96Q1 or 95Q1. You can now use ReportSmith to group these
quarters together to create a quarterly summary of your data.