Focal Point
Set current date as default

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

February 20, 2008, 07:23 PM
JOE
Set current date as default
Is there a way to set a drop down list to default to current date?

Thanks,

Joe


WebFocus 7.7.02 WinXP
February 21, 2008, 02:59 AM
Tony A
Joe,

Use Javascript functionality within the Onload function.

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 
February 21, 2008, 03:01 AM
GamP
Yes Joe, that is possible. But it depends a bit on what you're using to create the drop down box. If it is the html layout painter, then this thing does not have the possibility to do that. But if you're using a fex to populate the box, then you can do this easily by coding it in a define:
DEFINE FILE file
OPTIONDATE/A100 = IF DATEFLD EQ '&YYMD' THEN
    '<OPTION NAME=DATEFLD SELECTED VALUE='| DATEFLD | '>'| DATEFLD | '</OPTION>' ELSE
    '<OPTION NAME=DATEFLD VALUE='| DATEFLD | '>'| DATEFLD | '</OPTION>';
END

TABLE FILE FILE
PRINT OPTIONDATE
ON TABLE PCHOLD
END

And then use the resulting hold file to populate your drop-down box.

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
February 21, 2008, 01:29 PM
JOE
I found an active x function called date picker. I placed this object on my html form and assigned it the variable name dte. When I run the code, it does not recognize the dte variable. Here is my code.
 <HTML>
<HEAD>
<TITLE>HtmlPage</TITLE>
<BASE href=HTTP://ppnta369:8080>
<META content="MSHTML 6.00.2900.3243" name=GENERATOR>
<SCRIPT id=clientEventHandlersJS type=text/javascript>
//Begin function window_onload
function window_onload() {
UpdateData();
// TODO: Add your event handler code here
}
//End function window_onload
</SCRIPT>

<SCRIPT for=window eventname="onload">window.onload = function() { window_onload(); }</SCRIPT>
</HEAD>
<BODY style="OVERFLOW: auto">
<FORM id=form2 style="Z-INDEX: 3; LEFT: 90px; WIDTH: 509px; POSITION: absolute; TOP: 170px; HEIGHT: 265px" tabIndex=3 name=form2 onsubmit="OnExecute(this);return false;" method=post requests_list="0" fexlist_list="report1" default_slider_type="4" form_prompt_location="1" form_number_of_visible_rows="4" form_number_of_columns="4" vert_dist_between_controls="10" form_hor_dist_between_controls="10" form_dist_between_desc_and_input="10">
<OBJECT id=activex1 style="Z-INDEX: 1; LEFT: 170px; WIDTH: 110px; POSITION: absolute; TOP: 100px; HEIGHT: 30px" tabIndex=1 classid=clsid:20DD1B9E-87C4-11D1-8BE3-0000F8754DA1 name=dte>
<PARAM NAME="_ExtentX" VALUE="2910">
<PARAM NAME="_ExtentY" VALUE="794">
<PARAM NAME="_Version" VALUE="393216">
<PARAM NAME="MousePointer" VALUE="0">
<PARAM NAME="Enabled" VALUE="1">
<PARAM NAME="OLEDropMode" VALUE="0">
<PARAM NAME="CalendarBackColor" VALUE="-2147483643">
<PARAM NAME="CalendarForeColor" VALUE="-2147483630">
<PARAM NAME="CalendarTitleBackColor" VALUE="-2147483633">
<PARAM NAME="CalendarTitleForeColor" VALUE="-2147483630">
<PARAM NAME="CalendarTrailingForeColor" VALUE="-2147483631">
<PARAM NAME="CheckBox" VALUE="0">
<PARAM NAME="CustomFormat" VALUE="">
<PARAM NAME="DateIsNull" VALUE="0">
<PARAM NAME="Format" VALUE="662831105">
<PARAM NAME="UpDown" VALUE="0">
<PARAM NAME="CurrentDate" VALUE="39499">
<PARAM NAME="MaxDate" VALUE="2958465">
<PARAM NAME="MinDate" VALUE="-109205"></OBJECT>
<INPUT id=form2Submit style="Z-INDEX: 4; LEFT: 5px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/run16.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 78px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=4 type=submit value=" " name=ITEM1> 
<INPUT id=form2Reset style="Z-INDEX: 5; LEFT: 48px; BACKGROUND-IMAGE: url(/ibi_html/javaassist/ibi/html/describe/reset.gif); WIDTH: 38px; BACKGROUND-REPEAT: no-repeat; POSITION: absolute; TOP: 78px; HEIGHT: 22px; BACKGROUND-COLOR: lavender" tabIndex=5 type=reset value=" " name=reset1> 
<FIELDSET id=form2_formbodyid style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; Z-INDEX: 6; LEFT: 5px; PADDING-BOTTOM: 0px; OVERFLOW: auto; WIDTH: 499px; BORDER-TOP-STYLE: none; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; POSITION: absolute; TOP: 5px; HEIGHT: 73px; BORDER-BOTTOM-STYLE: none" tabIndex=6 formbody="1">
<SPAN id=pane1 style="Z-INDEX: 7; LEFT: 0px; WIDTH: 477px; POSITION: absolute; TOP: 0px; HEIGHT: 51px" tabIndex=7 elementtype="32" name="Manager">Manager 
<SELECT id=combobox1 style="Z-INDEX: 8; LEFT: 0px; WIDTH: 477px; POSITION: absolute; TOP: 15px; HEIGHT: 22px" tabIndex=8 size=1 name=Manager defaultlocation="29,0,51,477" dfformat="A50V" ibiformat="A50V" addalloption="0" accept="0" operation datafield="MANAGER" displayfield="MANAGER" datasource="team_hiarchy.mas" requiredfield="36074408" datatype="1" datafieldtype="INTIGER" sourcetype="typeMaster"></SELECT></SPAN></FIELDSET></FORM>
<xml id=ibi_requests>
<requests>
	
<request requestid="0" targetname="report1" ibif_ex="report1" targettype="0" sourcetype="typeAdhocfex" ibiapp_app="">
		
<![CDATA[-* File TEAMADSCORES.fex
JOIN
 TEAM_HIARCHY.TEAM_HIARCHY.TEAMNAME IN TEAM_HIARCHY TO MULTIPLE
 TBLARCH.TBLARCH.TEAMNAME IN TBLARCH AS J0
 END
TABLE FILE TEAM_HIARCHY
SUM
     COMPUTE COMPPER/D12.1% = ( COMPLIANCE / SCHEDULED ) * 100;
 AS 'Compliance %'
BY TEAMNAME
HEADING
"&Manager<+0> <+0>for <+0>&dte"
FOOTING
""
WHERE MANAGER EQ '&Manager';
WHERE NOM_DATE EQ '&dte';
ON TABLE SET PAGE-NUM OFF
ON TABLE SUMMARIZE COMPPER AS 'TOTAL'
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     PAGESIZE='Letter',
     LEFTMARGIN=0.250000,
     RIGHTMARGIN=0.250000,
     TOPMARGIN=0.250000,
     BOTTOMMARGIN=0.250000,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
     DEFMACRO=COND0001,
     MACTYPE=RULE,
     WHEN=N2 LT .90,
$
     DEFMACRO=COND0002,
     MACTYPE=RULE,
     WHEN=N2 LT 90,
$
     GRAPHTYPE=DATA,
     COLUMN=N2,
     GRAPHCOLOR='GREEN',
     GRAPHLOOK=BAR,
$
     GRAPHTYPE=DATA,
     COLUMN=N2,
     GRAPHCOLOR='RED',
     MACRO=COND0002,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=10,
     COLOR='BLACK',
     BACKCOLOR='NONE',
     STYLE=NORMAL,
     RIGHTGAP=0.125000,
$
TYPE=DATA,
     COLOR=RGB(45 32 15),
$
TYPE=DATA,
     COLUMN=N1,
     TARGET='_self',
     FOCEXEC=v4adh(TEAMNAME=N1 dte=&dte.QUOTEDSTRING),
$
TYPE=TITLE,
     COLOR=RGB(199 135 73),
     STYLE=-UNDERLINE+BOLD,
$
TYPE=HEADING,
     SIZE=18,
     COLOR='WHITE',
     BACKCOLOR=RGB(191 54 61),
     STYLE=BOLD,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=1,
     FONT='VERDANA',
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=2,
     FONT='VERDANA',
     STYLE=BOLD+ITALIC,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=3,
     FONT='VERDANA',
     SIZE=10,
     STYLE=BOLD+ITALIC,
$
TYPE=HEADING,
     LINE=1,
     OBJECT=TEXT,
     ITEM=4,
     FONT='VERDANA',
     SIZE=10,
     STYLE=BOLD+ITALIC,
$
TYPE=FOOTING,
     COLOR=RGB(45 32 15),
     BACKCOLOR=RGB(199 135 73),
     STYLE=BOLD,
$
TYPE=SUBHEAD,
     SIZE=18,
     COLOR=RGB(191 54 61),
     BACKCOLOR='WHITE',
     STYLE=BOLD,
$
TYPE=SUBFOOT,
     COLOR=RGB(199 135 73),
     BACKCOLOR=RGB(45 32 15),
     STYLE=BOLD,
$
ENDSTYLE
END]]>
		
<variables>
			
<variable field="Manager" file="team_hiarchy.mas" desc="Manager" datatype="0" operation="" default="" name="Manager" textvarname="" accept="0" type="unresolved" select="0" min="" max="" controltype="7" create="1"></variable>
			
<variable field="dte" file="team_hiarchy.mas" desc="dte" datatype="0" operation="" default="" name="dte" textvarname="" accept="0" type="unresolved" select="0" min="" max="" controltype="7" create="1"></variable></variables></request></requests>
</xml></BODY></HTML> 


Thanks!


WebFocus 7.7.02 WinXP
February 22, 2008, 04:41 AM
GamP
Joe,

I think this is due to the fact that it concerns an active-x object in this case.
It does not have one single well-defined and standard value, so the form that it resides in will not pass the values on. Maybe there is a way to retrieve the values from an active-x object using javascript, but I'm afraid that such coding is way beyond my knowledge.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988