Focal Point
[SOLVED]Calendar Default Date

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

August 31, 2011, 08:06 PM
Saravanan J
[SOLVED]Calendar Default Date
Hi,

I created a calendar control in my HTML and had set its date forrmat to "trMYY". Now i try to set a default value to the calandar through IBI.AMP variable and pass the value from a fex. Irrespective of what ever format i set my local variable (using CHGDAT or DATECVT) it always displays in YYMD format in the HTML. I want the default date to be displayed as trMYY and it has to be a valid date (not a string) because this value will be passed to the backend when the form is submited. I have not tried JS yet, before that i would like to know if this is something tat can be accomplished through FEX.



The default value i used in HTML form is 

!IBI.AMP.CURRENT_DT;



The fex used to call the html looks like this

-SET &CURRENT_DT = &YYMD.EVAL;
-HTMLFORM client_revenue_detail.htm


This message has been edited. Last edited by: Saravanan J,


Release : 7.7.02
OS : Linux
App Server : Tomcat
all output
August 31, 2011, 08:41 PM
Waz
You are setting &CURRENT_DT to &YYMD, What is the defined format of the calendar control ?

What happens if you set &CURRENT_DT to a valid trMYY date ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

September 01, 2011, 12:48 PM
Dan Satchell
Try something like this for creating your calendar default value:

-SET &CUR_YYM   = EDIT(&YYMD,'999999$$');
-SET &RPT_MTHYY = LCWORD(14,CHGDAT('A6YYM','MXYY',&CUR_YYM,'A14'),'A14');
-SET &RPT_MONTH = GETTOK(&RPT_MTHYY,&RPT_MTHYY.LENGTH,1,' ',9,'A9') || ',&|nbsp;' ||
-                 GETTOK(&RPT_MTHYY,&RPT_MTHYY.LENGTH,2,' ',4,'A4');



WebFOCUS 7.7.05
September 01, 2011, 02:26 PM
Saravanan J
Thanks much Dan, your code works perfect. It also points the calendar to the default date on initial load. I had problem with using the
 &|nbsp; 
. It throws js script error, so i removed it. Is there a workaround for that? Even otherwise i am good without the space between month and year.


Waz, -SET does not allow me to set the type of the date. When i tried setting the value like
-SET &CURRENT_DT = 'September, 2011';

the calander did not recognize it as a date.


Release : 7.7.02
OS : Linux
App Server : Tomcat
all output
September 01, 2011, 03:23 PM
Doug
quote:
-SET &CURRENT_DT = 'September, 2011';
is more of a STRING, not a DATE (has no day number).