Hi,
I'm using Crystal Report 10 (will soon be upgrading to XI) and using DB2 tables.
Every month, I open Crystal reports and change the dates in the record selection criteria. I would like to stop manually changing the dates in Crystal and automate this report and then schedule it in CE. I do not want to have to enter date parameters.
Last month, the report ran with the following record selection:
{RPLC_T.CREATE_DT} <= Date (2007, 12, 27);
While I was trying to automate this report, I know that to obtain Date (2007, 12, 27), I can also run the following query:
SELECT MAX(A.CLNDR_DT)
FROM BP.DATE_DMN_T A,
(SELECT CURRENT DATE as CURRENT_DT, CLNDR_DT, FSCL_MONTH_END_DT,
CAST((SUBSTR(CHAR(FSCL_MONTH_END_DT - 1 MONTH) ,1,4) ||
SUBSTR(CHAR(FSCL_MONTH_END_DT - 1 MONTH) ,6,2)) AS INTEGER) AS PREV_FSCL_YR_MONTH_NUM
FROM BP.DATE_DMN_T
WHERE CLNDR_DT = CURRENT DATE) P
WHERE A.FSCL_YR_MONTH_NUM = P.PREV_FSCL_YR_MONTH_NUM;
Can I create a formula that contains the above SQL statement and then use the formula in the record selection criteria such as:
{RPLC_T.CREATE_DT} <= MAXDATE);
MAXDATE would of course would contain the SQL SELECT statement above.
I tried creating an SQL Expression with the above SQL SELECT (SELECT MAX(A.CLNDR_DT) ....) but it gives me an error:
Error in compiling SQL Expression : Query Engine Error: IBM....
What is the most efficient way to fix the record selection problem I'm having.
Thank you in advance.
I'm using Crystal Report 10 (will soon be upgrading to XI) and using DB2 tables.
Every month, I open Crystal reports and change the dates in the record selection criteria. I would like to stop manually changing the dates in Crystal and automate this report and then schedule it in CE. I do not want to have to enter date parameters.
Last month, the report ran with the following record selection:
{RPLC_T.CREATE_DT} <= Date (2007, 12, 27);
While I was trying to automate this report, I know that to obtain Date (2007, 12, 27), I can also run the following query:
SELECT MAX(A.CLNDR_DT)
FROM BP.DATE_DMN_T A,
(SELECT CURRENT DATE as CURRENT_DT, CLNDR_DT, FSCL_MONTH_END_DT,
CAST((SUBSTR(CHAR(FSCL_MONTH_END_DT - 1 MONTH) ,1,4) ||
SUBSTR(CHAR(FSCL_MONTH_END_DT - 1 MONTH) ,6,2)) AS INTEGER) AS PREV_FSCL_YR_MONTH_NUM
FROM BP.DATE_DMN_T
WHERE CLNDR_DT = CURRENT DATE) P
WHERE A.FSCL_YR_MONTH_NUM = P.PREV_FSCL_YR_MONTH_NUM;
Can I create a formula that contains the above SQL statement and then use the formula in the record selection criteria such as:
{RPLC_T.CREATE_DT} <= MAXDATE);
MAXDATE would of course would contain the SQL SELECT statement above.
I tried creating an SQL Expression with the above SQL SELECT (SELECT MAX(A.CLNDR_DT) ....) but it gives me an error:
Error in compiling SQL Expression : Query Engine Error: IBM....
What is the most efficient way to fix the record selection problem I'm having.
Thank you in advance.