Focal Point
[CLOSED] Default parameter is a calculated date

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

July 07, 2017, 06:19 AM
Nana
[CLOSED] Default parameter is a calculated date
Hi all,

I have used this in a fex but it doesn't work
-SET &DATVAN = AYMD (&YYMD, -7, 'I8YYMD');

-DEFAULT &DATUM_VAN_JJJJMMDD =&DATVAN.EVAL

TABLE FILE T_VISIT
\PRINT *
WHERE LASTCHANGE GE DT(&DATUM_VAN_JJJJMMDD);
END
-EXIT

By running this fex an error is trown :
0 ERROR AT OR NEAR LINE 7 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC177) INVALID DATE CONSTANT : &DATVAN.EVAL
(FOC009) INCOMPLETE REQUEST STATEMENT

Any help ?

This message has been edited. Last edited by: FP Mod Chuck,


WF 7.6.11
Windows, All Outputs
July 07, 2017, 07:54 AM
BabakNYC
1. What's the format of LASTCHANGE?
2. Can you test your code by removing the .EVAL?
3. Are you really running 7.6?

This message has been edited. Last edited by: BabakNYC,


WebFOCUS 8206, Unix, Windows
July 07, 2017, 08:06 AM
MartinY
Everything should work except that I would use the SET variable, no need to re-assign to a DEFAULT one :
TABLE FILE T_VISIT
PRINT *
WHERE LASTCHANGE GE DT(&DATVAN);
END
-EXIT

Also, I don't know your metadata so maybe you could have an issue with LASTCHANGE date but I don't think that you will.

As per below, it should work :
SET &ECHO = ALL
-SET &DATVAN = AYMD (&YYMD, -7, 'I8YYMD');

TABLE FILE GGSALES
PRINT *
WHERE DATE LE DT(&DATVAN);
END
-RUN


P.S. : please try not to duplicate your post


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
July 07, 2017, 08:09 AM
Nana
Hi Babak,


Lastchange is a datetime field.
The fex runs on an oracle database.

Also without Eval it isn't working.

It seems that my version of Wf isn't up to date.
I'm using version 8.0.09.
sorry


WF 7.6.11
Windows, All Outputs
July 07, 2017, 08:10 AM
Danny-SRL
This works for me:
 
-SET &DATVAN = AYMD (&YYMD, -7, 'I8YYMD');

-DEFAULT &DATUM=&DATVAN.EVAL

-TYPE D=&DATVAN  H=&DATUM
 

This message has been edited. Last edited by: Danny-SRL,


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

July 07, 2017, 08:12 AM
Nana
we want to give the opportunity to enter a date to the user.
In case the user don't gives a specific date , a default date has to be used.


WF 7.6.11
Windows, All Outputs
July 07, 2017, 08:19 AM
Tony A
quote:
WF 7.6.11

I am not sure when the ability to assign a variable to a variable default became available. If you are on 7.6.11 as your signature implies then you might not be able to do this.

This ability was discussed a while ago now but you should be able to perform a search and find the thread.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
July 07, 2017, 08:21 AM
Danny-SRL
Nana,
This runs without a problem:
  
-SET &DATVAN = AYMD (&YYMD, -7, 'I8YYMD');
-DEFAULT &DATUM=&DATVAN.EVAL

TABLE FILE CAR
HEADING
"DEFAULT=&DATUM "
PRINT COUNTRY
END

Could it be your version of WF?


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

July 07, 2017, 08:32 AM
BabakNYC
Are you using Auto Prompt or launching it with an HTML page?


WebFOCUS 8206, Unix, Windows
July 07, 2017, 08:33 AM
MartinY
I've test it under 7.7.05M and 8.1.05M and it works fine so you shouldn't have any issue under 8.0.0.9. (even if 8009 is not the best version...)

And since everyone of us test it under different versions, the issue may reside on your side.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
July 07, 2017, 08:51 AM
BabakNYC
The problem is Nana wants to set a default value for the date field AND prompt for it so the user has a choice of entering something other than last week. However, I remember something about Auto Prompt not evaluating the -DEFAULT value and just displaying the variable name instead of the value for last week. If you turn off auto prompt the code will work (sans prompt), but if you have it on it doesn't.


WebFOCUS 8206, Unix, Windows
July 07, 2017, 08:55 AM
Nana
We are using autoprompt


WF 7.6.11
Windows, All Outputs
July 07, 2017, 09:03 AM
MartinY
The following will work with auto-prompting (but no validation on entered date is performed, so personally I wouldn't use that option) :
-SET &DEFAULT_DATE = AYMD (&YYMD, -7, 'I8YYMD');
-SET &TEST_DATE    = IF &PROMPT_DATE EQ 'FOC_NONE' OR '_FOC_NULL' OR '' THEN &DEFAULT_DATE ELSE &PROMPT_DATE;

-TYPE DEFAULT_DATE: &DEFAULT_DATE, PROMPT_DATE: &PROMPT_DATE, TEST_DATE: &TEST_DATE



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
July 07, 2017, 11:44 AM
FP Mod Chuck
Hi

I believe I read that LASTCHANGE is a date time field and the &DATUM_VAN_JJJJMMDD is only being set to a YYMD format and not a full date and timestamp.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats