on 10-22-2005 12:31 PM
Dear all,
I have a dropwdown box with key, Now my requirement is to fill this dropdown box with 30 dates..I tried it but getting runtime error. can anybody suggest a way out.
String datelist[] = new String[30];
SimpleDateFormat dtFormat = new SimpleDateFormat("dd.MM.yyyy");
ISimpleTypeModifiable myType=wdThis.wdGetAPI().getContext().getModifiableTypeOf("days");
// ArrayList ldate = new ArrayList();
for (int i = 0; i < 31; ++i) {
datelist<i> = dtFormat.format(new java.util.Date());
IModifiableSimpleValueSet values=myType.getSVServices().getModifiableSimpleValueSet();
values.put("i", "datelist<i>");
}
Regds
Anup
Anup,
What is a type of "days" attribute?
See comments in the following code and use one form for "string" and other one for "date" types:
final Calendar calendar = Calendar.getInstance
(
WDResourceHandler.getCurrentSessionLocale()
);
calendar.setTimeInMillis( System.currentTimeInMillis() );
final SimpleDateFormat dtFormat = new SimpleDateFormat("dd.MM.yyyy");
final ISimpleTypeModifiable myType=wdContext()
.getModifiableTypeOf("days");
final IModifiableSimpleValueSet values = myType
.getSVServices()
.getModifiableSimpleValueSet();
values.clear();
/* 30 days from now */
for (int i = 0; i < 31; ++i)
{
final java.sql.Date date =
new java.sql.Date( calendar.getTimeInMillis() );
final String dateStr = dtFormat.format( date );
/* if type is <b>string</b> */
values.put( dateStr, dateStr );
/* else if type is <b>date</b> */
values.put( date, dateStr );
calendar.add( Calendar.DATE, 1 );
}
Valery Silaev
EPAM Systems
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.