Focal Point
Dynamic Date Range parameter

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8897073626

November 19, 2012, 09:45 AM
BKR
Dynamic Date Range parameter
I am trying to create a dynamic date range parameter for a field called WORK_DATE for a report/procedure. Here is my where statement:

WHERE ( WORK_DATE GE 'YYMD(&Today,-14,'I8YYMD')' ) AND ( WORK_DATE LE '&Today' );

However, I am getting the following error when running the report:

0 ERROR AT OR NEAR LINE 35 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC257) MISSING QUOTE MARKS: 'YYMD( ,-14,'I8YYMD
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT


7.6.8, Windows XP
Excel, PDF, Active HTML, HTML, PDF
November 19, 2012, 02:01 PM
Dan Satchell
Move the calculation of the begin date to Dialogue Manager before your TABLE FILE:

-SET &BEG_DATE = AYMD(&Today,-14,'I8YYMD');
-*
TABLE FILE xxx
PRINT/SUM ...
BY ...
WHERE ( WORK_DATE GE '&BEG_DATE' ) AND ( WORK_DATE LE '&Today' );
END



WebFOCUS 7.7.05
November 21, 2012, 09:02 AM
BKR
Hi Dan,

I tried your suggestion and received the following run time error:

(FOC1400) SQLCODE IS 206 (HEX: 000000CE) XOPEN: 22018
: Microsoft SQL Native Client: [22018] Operand type clash: date is incompa
: tible with tinyint [42000] Statement(s) could not be prepared. [] Deferr
: ed prepare could not be completed.
L (FOC1406) SQL OPEN CURSOR ERROR. : NUR_TIMECARDS


7.6.8, Windows XP
Excel, PDF, Active HTML, HTML, PDF
November 21, 2012, 10:24 AM
Francis Mariani
You have to be aware of the format of your date columns.

What does the SQL line look like? (You need to turn WebFOCUS SQL traces on to see the generated SQL).


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 21, 2012, 10:41 AM
BKR
The date format of this WORK_DATE field in SQL is YYYY-MM-DD but, when I pull the field into WebFocus 7.6.8 using a SQL 2005 adapter the field is converted to A10V format. So, I went into the master file and converted the Usage from A10V to YY-M-D and type from Alpha variable in characters to date type.


7.6.8, Windows XP
Excel, PDF, Active HTML, HTML, PDF
November 21, 2012, 10:58 AM
Francis Mariani
What does your SQL look like?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 21, 2012, 11:06 AM
BKR
Here is an example of what a WORK_DATE value and other dates look like in SQL:
YYYY-MM-DD
2012-11-12


7.6.8, Windows XP
Excel, PDF, Active HTML, HTML, PDF
November 21, 2012, 11:23 AM
BKR
I thought you meant what does your SQL field format look like. What do you mean when you say "What does your SQL look like?"


7.6.8, Windows XP
Excel, PDF, Active HTML, HTML, PDF
November 21, 2012, 12:08 PM
Prarie
Hi BKR

Put this at the top of your fex and run it. It will print out the SQL generated.

 SET TRACEOFF=ALL
SET TRACEON=SQLAGGR//CLIENT
SET TRACEON=STMTRACE//CLIENT
SET TRACEON=STMTRACE/2/CLIENT
SET TRACEUSER=ON
SET TRACESTAMP=OFF
SET XRETRIEVAL=OFF
 

November 21, 2012, 02:15 PM
BKR
Hi Prairie,

I inputted the following code at the top of the fex:
SET TRACEOFF=ALL
SET TRACEON=SQLAGGR//CLIENT
SET TRACEON=STMTRACE//CLIENT
SET TRACEON=STMTRACE/2/CLIENT
SET TRACEUSER=ON
SET TRACESTAMP=OFF
SET XRETRIEVAL=OFF

I then ran the fex and received the HTML page with:

1. An empty BEG_DATE parameter box
2. An empty Today parameter box
3. A drop-down charge_dept parameter

I clicked the run buttom and received an excel spreadsheet with the charge department selected displayed and no data.

Brian.


7.6.8, Windows XP
Excel, PDF, Active HTML, HTML, PDF
November 21, 2012, 02:51 PM
Francis Mariani
When debugging a program that you know isn't going to return a report because there's an error, you ought not to output Excel.

Change it to HTML. Run the program. View source. Look for the error. Look for the generated SQL.

I'm not sure modifying the master is the correct approach. "The date format of this WORK_DATE field in SQL is YYYY-MM-DD" - is this what the data looks like, but is the column defined as a date formatted column?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
November 22, 2012, 04:17 PM
BKR
When running the report with the suggested SET parameters, I don't get any errors but, on the html output I don't get any data. The WORK_DATE column looks like YYYY-MM-DD and in SQL it is defined is defined as a date formatted column but alphanumeric variable column of 10 characters in WebFocus. I hope this answers your question.


7.6.8, Windows XP
Excel, PDF, Active HTML, HTML, PDF