Focal Point
[Solved] Date Formatting for Calendar control

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

June 12, 2012, 05:05 PM
Tara O
[Solved] Date Formatting for Calendar control
I am using the calendar control through the HTML composer.

On my calendar control no matter what I set as my "Date format in data source" the calendar contol sends my DB something like BETWEEN '19011204' AND '19051206' .

If I manually type in the boxes 01-09-2010 then it processes properly and sends
BETWEEN '20100109' AND '20100109' ... and I get data.

I have date formatted as 2009-01-01 in my database and in my master file source format is just Date. In my fex I am only using the date as a parameter.

And in the calendars when you pick a date it shows in the box as yymdd , not what I want either.

Any ideas?

This message has been edited. Last edited by: Kathleen Butler,


8002 Windows
June 13, 2012, 07:07 AM
GamP
For me it works fine. The calender presents the dates in the format I specify and also the dates are in the request as entered. I specified the format to be YYMD, and as a consequence I need to enter it in YYMD format, and the values are transported back to WebFocus in my & vars as YYMD.

What exactly is it that you need?
Please post the code you have already...and indicate where things go wrong in your view.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
June 13, 2012, 10:06 AM
KenFR
The DEFCENT command (default century) may get you past the year coming in as 1901. After that you could use EDIT to rearrange the date pieces into your data's format
  
-SET &TEST = EDIT(&BEGIN_DATE,'$$$$9');
-SET &TEST2 = EDIT(&BEGIN_DATE,'9999') ||'-'|| EDIT(&BEGIN_DATE,'$$$$$99') ||'-'|| EDIT(&BEGIN_DATE,'$$$$$$$$99');
-SET &TEST5 = EDIT(&BEGIN_DATE,'9999') ||'-'|| EDIT(&BEGIN_DATE,'$$$$99') ||'-'|| EDIT(&BEGIN_DATE,'$$$$$$99');
-SET &BGNDTED = IF &TEST EQ '/' THEN &TEST2 ELSE &TEST5;
  



8105 Tomcat and AIX reporting server
input: Teradata, SQL, DB2, Essbase, Oracle, text
output:html, excel, PDF,
June 13, 2012, 10:12 AM
Tara O
Thanks for the response. I am a newbie so I appologize if my reponses are vague in anyway....(and I am using 7703 with hotfix 2).

My problem is really with the calendar control in HTML. It seems confused, like I pick June 5, 2012 from the calendar, what ends up in the box is 12/06/05 and what appears in the sql (I have a sql tracker turned on ) is 19051206. So it is reading what is in the box as month day year , but what is in the box if formatted wrong.

What I want is to pick June 5, 2012 from the calendar, have 06/05/2012 show up in the box this would result in '20120605' in the SQL.... and work.

If I manually type 06/05/2012 in the box and do not select from the calendar, everything works fine. So it is really getting the calendar control to put that format in the box when I use the dashbaord that I have a question about.

I have attached my fex code and the code excerpt from my query:


Here is my fex code :

TABLE FILE IBI_TABLE_ID_XREF
SUM
CNT.IBI_TABLE_ID_XREF.IBI_TABLE_ID_XREF.VISITID WITHIN J13.IBI_TABLE_PATIENT_CLASS_DSC.PATIENTCLASSNAME AS 'COUNT,IBI_TABLE_ID_XREF.IBI_TABLE_ID_XREF.VISITID'
BY J13.IBI_TABLE_PATIENT_CLASS_DSC.PATIENTCLASSNAME
WHERE ( J12.IBI_TABLE_LOS_DT.DISCHARGE_DT GE '&StartDISCHARGE_DT.(<10/1/2009,10/1/2009>).Report Start Date.' ) AND ( J12.IBI_TABLE_LOS_DT.DISCHARGE_DT LE '&EndDISCHARGE_DT.(<10/1/2009,10/1/2009>).Report End Date.' );
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE COLUMN-TOTAL AS 'TOTAL' 'IBI_TABLE_ID_XREF.IBI_TABLE_ID_XREF.VISITID'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
INCLUDE = endeflt,
$
ENDSTYLE
END


8002 Windows
June 13, 2012, 10:16 AM
Tom Flynn
Open your page in HTML Compser, click on the Calendar box, select parameters, and, in the dropdown under Date format in data source, select the MDYY format...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
June 13, 2012, 10:16 AM
Tara O
Sorry heres my HTML also :




<script id=IBI_RelCallBack type=text/javascript>function AdjustChildrenPosition(){
}


<script id=IBI_OptionsScript type=text/javascript>
var cgipath = "cgipath";
var ibirls = "ibirls3";

var rltdyncalendar = "rltdyncalendar";
var gmap = "ibigmap";
var olap="olap";
var olappanebase="olappanebase";
var olapdrill="olapdrill";

var ibixmltree="ibixmltree";

var ibiOptions = new Array(cgipath,ibirls,rltdyncalendar);


<script id=IBI_nls src="/ibi_html/javaassist/nls.js" type=text/javascript>

<script id=IBI_nlsVars src="/ibi_html/javaassist/nlsvars.js" type=text/javascript>

<script id=IBI_ibigbl src="/ibi_html/javaassist/ibi/html/js/ibigbl.js" type=text/javascript>

<script id=IBI_ibigblloadCss type=text/javascript>
ibigblloadCss(null);
addIntlTranslatedJS("composertrans.js");

HtmlPage
<script id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {

UpdateData();

// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
}
//End function window_onload

//Begin function button1_onclick
function button1_onclick(ctrl) {
// TODO: Add your event handler code here
OnExecute(ctrl)
}
//End function button1_onclick


<script for=window type=text/javascript eventname="onload">window.onload = function() { window_onload(); }
















<script type="text/xml" nextelementuniquenumber="5">
























8002 Windows
June 13, 2012, 10:19 AM
Tom Flynn
We don't need your code, AND, you need to put "code" between the </> tags...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
June 13, 2012, 10:27 AM
Tara O
Sorry , cut of my post Here is part I think you may need:



























































<script id=IBI_loadcalendar type=text/javascript>
if(ibigblInitInfo.testOptions(rltdyncalendar)){
setDateRange();
setupDocCalendars();
}

<script id=IBI_loader type=text/javascript>
doBeforeLoad();




8002 Windows
June 13, 2012, 10:40 AM
Tara O
Hi Tom,
The "Data Format in Data Source" box seems to be doing nothing. I can change it to MDYY and (T4."Discharge_Dt" BETWEEN '19051206' AND '19051206') still ends up in SQL. For giggles I changed it to
wrMtrDYY and still get (T4."Discharge_Dt" BETWEEN '19051206' AND '19051206'). The diplayed date in the calendar box also remains as 12/06/05.

Thanks,
Tara


8002 Windows
June 13, 2012, 12:10 PM
Dan Satchell
Check the Properties box for your calendar control and make sure the property Name is the same as the variable name your focexec expects. Also check in the Parameters tab that your calendar control parameter (same as the property Name) is bound to the calendar control.


WebFOCUS 7.7.05
June 13, 2012, 02:09 PM
Alex
Click on the calender control in the HTML Composer, then select Properties and Settings from the View Menu. You can set the calender format that will be sent to your report in this dialogue box.


WF 7.7.04, WF 8.0.7, Win7, Win8, Linux, UNIX, Excel, PDF
June 13, 2012, 05:13 PM
Tara O
Dan -
Yeah that was IT!! I changed the Name and Unique Identifier and it works !
Thanks,
Tara


8002 Windows