<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: BLOCKED SCRIPT Working out which business year the current date is within</title><link>https://www.infopathdev.com:443/forums/thread/47256.aspx</link><pubDate>Wed, 23 Sep 2009 00:32:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47256</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47256.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=47256</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;You don&amp;#39;t need script for this.&amp;nbsp; You can just set the fields&amp;#39; default values to these formulas:&lt;/p&gt;&lt;p&gt;StartDate:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;concat(substring(today(), 1, 4), &amp;#39;-04-01&amp;#39;)&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;EndDate:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&amp;nbsp;concat(substring(today(), 1, 4)+1, &amp;#39;-03-31&amp;#39;)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;And remember to uncheck &amp;quot;Update this value when the result of the formula is recalculated.&amp;quot;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>BLOCKED SCRIPT Working out which business year the current date is within</title><link>https://www.infopathdev.com:443/forums/thread/47236.aspx</link><pubDate>Tue, 22 Sep 2009 13:18:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:47236</guid><dc:creator>imchrissoiam</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/47236.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=47236</wfw:commentRss><description>&lt;p&gt;Hi i&amp;#39;m new to VBScript in Infopath 03, so sorry if this I sound like an idiot. &lt;br /&gt;&lt;br /&gt;I&amp;#39;m trying to set a Start Date and an End Date based on Todays Date, its worth mentioning now i&amp;#39;m from the UK, so the day and month are the other way round. I want the start and end date to be between &lt;i&gt;01.04.*year*&lt;/i&gt; and &lt;i&gt;31.03.*year +1*&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;So for example if todays date was 12.12.09, the start and dates would be worked out as &amp;nbsp;01.04.2009 and 31.03.2010.&lt;br /&gt;Also if todays date is 24.02.2010, the start and dates would still be 01.04.2009 and 31.03.2010. Hopefully thats easy enough to understand.&lt;br /&gt;&lt;br /&gt;todays date is worked using the date() function by the Open Behaviour rules in Form Options, so it will always have the current date when the form is opened - &amp;quot;DD/MM/YYYY&amp;quot;.&amp;nbsp;No date picker is used.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Heres, the code i&amp;#39;ve managed so far, any help on this would be very much appreciated &lt;img style="VERTICAL-ALIGN:middle;" alt="smile.gif" src="http://http.cdnlayer.com/dreamincode/forums/style_emoticons/default/smile.gif" border="0" /&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;XDocument.DOM.setProperty &amp;quot;SelectionNamespaces&amp;quot;, &amp;quot;xmlns:xsi=&amp;quot;&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&amp;quot; xmlns:d=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/ado/dataFields&amp;quot;&amp;quot; xmlns:dfs=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/dataFormSolution&amp;quot;&amp;quot; xmlns:xdEnvironment=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2006/xslt/environment&amp;quot;&amp;quot; xmlns:xdUser=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2006/xslt/User&amp;quot;&amp;quot; xmlns:xsf2=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2006/solutionDefinition/extensions&amp;quot;&amp;quot; xmlns:xhtml=&amp;quot;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;quot; xmlns:tns=&amp;quot;&amp;quot;http://tempuri.org/&amp;quot;&amp;quot; xmlns:mime=&amp;quot;&amp;quot;http://schemas.xmlsoap.org/wsdl/mime/&amp;quot;&amp;quot; xmlns:tm=&amp;quot;&amp;quot;http://microsoft.com/wsdl/mime/textMatching/&amp;quot;&amp;quot; xmlns:soapenc=&amp;quot;&amp;quot;http://schemas.xmlsoap.org/soap/encoding/&amp;quot;&amp;quot; xmlns:soap=&amp;quot;&amp;quot;http://schemas.xmlsoap.org/wsdl/soap/&amp;quot;&amp;quot; xmlns:http=&amp;quot;&amp;quot;http://schemas.xmlsoap.org/wsdl/http/&amp;quot;&amp;quot; xmlns:wsdl=&amp;quot;&amp;quot;http://schemas.xmlsoap.org/wsdl/&amp;quot;&amp;quot; xmlns:my=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-02-16T14:02:17&amp;quot;&amp;quot; xmlns:xd=&amp;quot;&amp;quot;http://schemas.microsoft.com/office/infopath/2003&amp;quot;&amp;quot;&amp;quot; &amp;#39; &amp;#39;======= &amp;#39; The following function handler is created by Microsoft Office InfoPath. &amp;#39; Do not modify the name of the function, or the name and number of arguments. &amp;#39;======= &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Dim dtToday, dtStart, dtEnd &lt;/p&gt;
&lt;p&gt;Dim dtYear, dtMonth, dtDay &lt;/p&gt;
&lt;p&gt;Sub XDocument_OnLoad(eventObj)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;dtToday = XDocument.DOM.selectSingleNode(&amp;quot;my:myFields/my:dtToday&amp;quot;).Text &lt;/p&gt;
&lt;p&gt;&amp;#39;Code Here &lt;/p&gt;
&lt;p&gt;&amp;#39;XDocument.DOM.selectSingleNode(&amp;quot;my:myFields/my:dtStart&amp;quot;).Text = dtStart&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;#39;XDocument.DOM.selectSingleNode(&amp;quot;my:myFields/my:dtEnd&amp;quot;).Text = dtEnd&lt;/p&gt;
&lt;p&gt;&amp;nbsp;End Sub&lt;/p&gt;&lt;/blockquote&gt;</description></item></channel></rss>