<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: populate drop-down field programmatically</title><link>https://www.infopathdev.com:443/forums/thread/6501.aspx</link><pubDate>Fri, 15 Apr 2005 02:44:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:6501</guid><dc:creator>webuser</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/6501.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=6501</wfw:commentRss><description>Thank you very much, Patrick!</description></item><item><title>Re: populate drop-down field programmatically</title><link>https://www.infopathdev.com:443/forums/thread/6500.aspx</link><pubDate>Wed, 09 Mar 2005 08:50:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:6500</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/6500.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=6500</wfw:commentRss><description>Hi Ashwin,&lt;br /&gt;Welcome to the board. InfoPath SP1 supports .NET so you should be able to just create a .NET project for infopath and cut and paste the code in to a method in the FormCode.cs file and call it from OnLoad or from some OnClick handler. Should be pretty easy. &lt;br /&gt;&lt;br /&gt;As for the dates, I don't quite understand why the dropdown has the current system date. I'd have to lok at the form to understand this.&lt;br /&gt;&lt;br /&gt;Good luck,&lt;br /&gt;Patrick</description></item><item><title>populate drop-down field programmatically</title><link>https://www.infopathdev.com:443/forums/thread/4550.aspx</link><pubDate>Wed, 09 Feb 2005 16:33:30 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:4550</guid><dc:creator>webuser</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/4550.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=4550</wfw:commentRss><description>I see some great posts for binding dropdown fields to secondary data sources such as web services and DB connections.&lt;br /&gt;&lt;br /&gt;What I am trying to do is compute all the pay-periods (15th, 30th) from the current date, 4 months past and 12 months forward. Currently I use a web service to do this. But I feel that this is overkill, if I can do the same thing using Infopath's script capability linked to the document's onLoad() event handler. Here is my code in the web service:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[WebMethod]&lt;br /&gt;public String[] getEffectiveDateList()&lt;br /&gt;{&lt;br /&gt;  String[] dateList = new String[32];&lt;br /&gt;  int currDay;&lt;br /&gt;  int currMonth;&lt;br /&gt;  int currYear;&lt;br /&gt;  DateTime startDate = DateTime.Today.Date.AddMonths(-4).Date;&lt;br /&gt;  for (int count=0; count&amp;lt;32; count++)&lt;br /&gt;  {&lt;br /&gt;    currYear = startDate.Year;&lt;br /&gt;    currMonth = startDate.Month;&lt;br /&gt;    currDay = startDate.Day;&lt;br /&gt;     if (currDay &amp;lt;= 15)&lt;br /&gt;      currDay = 15;&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;      // Check if February and leap year&lt;br /&gt;      if (currMonth == 2)&lt;br /&gt;      {&lt;br /&gt;        if (DateTime.IsLeapYear(currYear))&lt;br /&gt;          currDay = 28;&lt;br /&gt;        else&lt;br /&gt;          currDay = 27;&lt;br /&gt;      }&lt;br /&gt;      else if (currMonth == 1 || currMonth == 3&lt;br /&gt;               || currMonth == 5 || currMonth == 7&lt;br /&gt;               || currMonth == 8 || currMonth == 10&lt;br /&gt;               || currMonth == 12)&lt;br /&gt;        currDay = 31; // all months with 31 days&lt;br /&gt;      else&lt;br /&gt;        currDay = 30; // all months with 30 days&lt;br /&gt;    }&lt;br /&gt;    //instantiate new date object with calculated pay-period date&lt;br /&gt;    startDate = new DateTime(currYear, currMonth, currDay).Date;&lt;br /&gt;    //add to date list&lt;br /&gt;    dateList[count] = formatDate(startDate);&lt;br /&gt;    startDate = startDate.AddDays(4);&lt;br /&gt;  }&lt;br /&gt;  //return list of dates&lt;br /&gt;  return dateList;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Can anyone guide me with using this code from within an onLoad() event within InfoPath? Also, even with the web service, somehow the drop down field has the current system date, in addition to the dates returned by the web service. But I do not want this date, as it may or may not be a pay-period date. I know the web service is not returning this date, since it is not returned from an independent invocation of the web method outside of InfoPath.&lt;br /&gt;&lt;br /&gt;I really appreciate any help!&lt;br /&gt;&lt;br /&gt;--Ashwin</description></item></channel></rss>