Focal Point
Default value for the drop down

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

April 18, 2007, 02:47 AM
<Shylaja>
Default value for the drop down
Hi,

There is a dropdown list, populated form a table. The current year and 5 years before the current year is displayed. To do this, there are some trasformations made. The code has been attached below. BUt i need to display the year before the current year as the default value.

Please help me out in implementing this.


-DEFAULTS &YR=' ';

TABLE FILE EMP_TAB
PRINT DST.AC_YR
BY HIGHEST AC_YR
ON TABLE HOLD AS DISTYEAR FORMAT ALPHA
END

FILEDEF yearlst DISK yrlst.txt
-RUN


DEFINE FILE DISTYEAR
TODAYDATE/YYMD=&YYMD;
TODAYYEAR/YY=TODAYDATE;
STRYEAR/A5=EDIT(AC_YR,'$99999$$$$$$$');
STRSEL/A9 = IF '&YR' EQ STRYEAR THEN ' SELECTED' ELSE ' ';
STROPTION/A120='';
END

TABLE FILE DISTYEAR
SUM STROPTION
BY HIGHEST AC_YR
WHERE AC_YR LE TODAYYEAR
WHERE RECORDLIMIT EQ 6
ON TABLE HOLD AS yrlst FORMAT ALPHA
END
April 18, 2007, 03:24 AM
Alan B
In the DEFINE I normally create the whole option tag.
  
STROPTION/A120 = IF '&YR' EQ STRYEAR THEN 
               <option value="'||   STRYEAR || 
               '" selected="selected">' || STRYEAR ||'</option>'  ELSE 
               <option value="'||   STRYEAR || 
               '>' || STRYEAR ||'</option>' ;

and in the html

  
<select>
!IBI.FIL.yrlst;
</select>



Alan.
WF 7.705/8.007