Focal Point
Date Input Parameter Issue

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

July 11, 2007, 08:42 PM
Nidhi
Date Input Parameter Issue
In my report there is an input parameter for Date, for which i need to set a default value from the column of a table, if nothing has been entered by the user.
Following is my code:

JOIN
TABLE1.COL_01 IN TABLE1
TO UNIQUE TABLE2.COL_05
IN TABLE2 AS J0
END

DEFINE FILE TABLE1
CURRENTDATE/A8YYMD = COL_04;
CURRENTDATESTR/A8 = CURRENTDATE;
END

TABLE FILE TABLE1
PRINT
COL_01 AS 'Column 1'
COL_02 AS 'Column 2'
CURRENTDATE AS 'Current Business date'
CURRENTDATESTR/A8 AS 'Current Date String'

-PROMPT &ENTER_DATE.Enter The date.MDYY;

- SET &DATEFINAL = CURRENTDATESTR;
- SET &ENTER_DATE = IF &ENTER_DATE NE '' THEN SUBSTR(10, &ENTER_DATE, 7, 10, 10, 'A8') || SUBSTR(10, &ENTER_DATE, 1, 2, 2, 'A8') || SUBSTR(10, &ENTER_DATE, 4, 5, 5, 'A8') ELSE &DATEFINAL ;

WHERE ( COL_03 EQ '&ENTER_DATE');
END

If I hardcode the value in DATEFINAL by replacing the line
- SET &DATEFINAL = CURRENTDATESTR;
with:
- SET &DATEFINAL = '20070327';
It works fine
Infact teh value in CURRENTDATESTR=20070327, but it does not work and gives me an error:
0 ERROR AT OR NEAR LINE 58 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC177) INVALID DATE CONSTANT: )
(FOC009) INCOMPLETE REQUEST STATEMENT
BYPASSING TO END OF COMMAND

Please suggest what can be other alternative, as i need to set the default value from the column of a table.
July 12, 2007, 03:06 AM
Tony A
Nidhi,

You are trying to combine dialogue manager with a table request which, as has been mentioned many times before on this forum, you cannot do.

Again, this would be covered in training courses, so press your management to provide some for you, and then you might have a chance of being productive without resorting to asking for guidance on this sort of problem.

Also try searching the forum for similar posts or asking amongst your colleagues who, no doubt, have raised this question before.

Above all demand some training from your management.

T
July 13, 2007, 10:11 AM
Anatess
Nidhi, you can't pass a field from your TABLE Request into Dialogue Manager variable without having to write it to a file and then having Dialogue Manager use -READ to retrieve it.

So, in my opinion, what you need to do first is to follow Tony's suggestion on getting training and/or read all the manuals and tutorials and then do something like this:

-* This is untested code...

-PROMPT &ENTER_DATE.Enter The date.MDYY;
-IF &ENTER_DATE EQ '' THEN GOTO NEXT01;

-SET &DATEFINAL = SUBSTR(10, &ENTER_DATE, 7, 10, 10, 'A8') || SUBSTR(10, &ENTER_DATE, 1, 2, 2, 'A8') || SUBSTR(10, &ENTER_DATE, 4, 5, 5, 'A8');

-NEXT01

JOIN
TABLE1.COL_01 IN TABLE1
TO UNIQUE TABLE2.COL_05
IN TABLE2 AS J0
END

DEFINE FILE TABLE1
CURRENTDATE/A8YYMD = COL_04;
CURRENTDATESTR/A8 = CURRENTDATE;
END

TABLE FILE TABLE1
PRINT
COL_01 AS 'Column 1'
COL_02 AS 'Column 2'
CURRENTDATE AS 'Current Business date'
CURRENTDATESTR AS 'Current Date String'

-IF &ENTER_DATE EQ '' THEN GOTO NEXT02;
WHERE ( COL_03 EQ '&DATEFINAL');
-GOTO NEXT03

-NEXT02
WHERE ( COL_03 EQ CURRENTDATESTR);

-NEXT03
END
-RUN


There's probably 5 million things wrong with that code I wrote above which is just a cut-and-paste of your original code re-organized to use a different WHERE clause when your &ENTER_DATE is not supplied.


WF 8.1.05 Windows