Skip to Content
author's profile photo Former Member
Former Member

populate dropdownwith key

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 22, 2005 at 01:17 PM

    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

    http://www.NetWeaverTeam.com

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.