<?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: Timesheet - Start date must be a Sunday the week must include 1st or 16th</title><link>https://www.infopathdev.com:443/forums/thread/116262.aspx</link><pubDate>Thu, 11 May 2017 04:25:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:116262</guid><dc:creator>NathanWynn</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/116262.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=116262</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;&lt;p&gt;&amp;nbsp;I don&amp;#39;t have the whole solution to your problem, but I have&amp;nbsp;the piece where you can always start the week on Sunday regardless what date&amp;nbsp;was picked from the DatePick or today(). For example: if 05/11/2017 picked, the week starts on&amp;nbsp;Sunday 05/07/2017&lt;/p&gt;&lt;p&gt;Create&amp;nbsp;Data type Whole Number &amp;#39;NumericDayOfWeek&amp;#39;&lt;/p&gt;&lt;p&gt;Create Data&amp;nbsp;type Date &amp;#39;WeekOf&amp;#39;. Optional&amp;nbsp;default value: today()&lt;/p&gt;&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;&lt;p&gt;Add a rule named: getNumericDayofWeek with the follow XPath: &lt;/p&gt;&lt;p&gt;&amp;nbsp;(number(substring(., 9, 2)) + number(number(substring(., 1, 4)) - (floor((14 - number(substring(., 6, 2))) div 12))) + floor(number(number(substring(., 1, 4)) - (floor((14 - number(substring(., 6, 2))) div 12))) div 4) - floor(number(number(substring(., 1, 4)) - (floor((14 - number(substring(., 6, 2))) div 12))) div 100) + floor(number(number(substring(., 1, 4)) - (floor((14 - number(substring(., 6, 2))) div 12))) div 400) + floor((31 * number(number(substring(., 6, 2)) + 12 * (floor((14 - number(substring(., 6, 2))) div 12)) - 2)) div 12)) mod 7&lt;/p&gt;&lt;/blockquote&gt;&lt;p dir="ltr"&gt;That simply get the&amp;nbsp;numeric value of&amp;nbsp;&amp;#39;Day of Week&amp;#39;, 0 = Sunday, 1 = Monday...&amp;nbsp;Example: When you run, &amp;#39;WeekOf&amp;#39; will have today&amp;#39;s date of&amp;nbsp;05/11/2017. With the rule runs automatically you will get a value of 4 (Thursday). To get to the Sunday, you just need to subtract the number value from the date picked. 05/11/2017 - 4 = 05/07/2017&lt;/p&gt;&lt;p dir="ltr"&gt;To achieve that&amp;nbsp;you add a second rule on &amp;#39;WeekOf&amp;#39;. We name the rule &amp;#39;IfNotSunday&amp;#39;&lt;/p&gt;&lt;p dir="ltr"&gt;Condition: If&amp;nbsp;&amp;#39;NumericDayOfWeek&amp;#39; is not 0 then run this rule:xdDate:AddDays(., -../my:NumericDayOfWeek)&lt;/p&gt;&lt;p dir="ltr"&gt;That rule simply subtract itself by the numeric value of Day of Week.&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;To get to what you need,&amp;nbsp;get the date of the Sunday + 7 or&amp;nbsp;-7 to find out the date range to make sure it contains 1 or 16. &lt;/p&gt;&lt;p dir="ltr"&gt;Hope that helps. Sorry if I was being wordy&amp;nbsp;or not clear.&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;p dir="ltr"&gt;&amp;nbsp;&lt;/p&gt;&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Timesheet - Start date must be a Sunday the week must include 1st or 16th</title><link>https://www.infopathdev.com:443/forums/thread/116156.aspx</link><pubDate>Fri, 28 Apr 2017 15:52:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:116156</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/116156.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=116156</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Any chance you could attach a sample form with the work you&amp;#39;ve already done? Under the Options tab in a reply - I can take a look &amp;amp; maybe give you a hand. :)&lt;/p&gt;</description></item><item><title>Timesheet - Start date must be a Sunday the week must include 1st or 16th</title><link>https://www.infopathdev.com:443/forums/thread/116094.aspx</link><pubDate>Thu, 20 Apr 2017 20:41:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:116094</guid><dc:creator>danilucky00</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/116094.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=116094</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I am working on a Semi-Monthly Timesheet form and having some issues with the start week.&amp;nbsp; The form will be filled out for 1-15 and 16- end of month.&lt;/p&gt;&lt;p&gt;Here are there requirements:&lt;/p&gt;&lt;p&gt;- Select start&amp;nbsp;of week by&amp;nbsp;using the Date Picker&lt;/p&gt;&lt;p&gt;- The start date must be a Sunday&lt;/p&gt;&lt;p&gt;- The&amp;nbsp;week must contain the 1st or 16th.&amp;nbsp;&lt;/p&gt;&lt;p&gt;I have a date picker, then I have days of the week below it in a table.&amp;nbsp; The table is in a section and I want to hide the section until a valid week is entered.&amp;nbsp;People tend to not put the correct date in and I&amp;nbsp;need validation&amp;nbsp;to prevent errors.&lt;/p&gt;&lt;p&gt;I am having issues getting&amp;nbsp;the rules setup. Just when it&amp;nbsp;looks like it starts to work, I always find a loop hole to bypass the validation. Sometimes I pick a Sunday and it doesn&amp;#39;t have a 1 or 16 but it still shows.&amp;nbsp; Sometimes I pick a valid week and it doesn&amp;#39;t show.&lt;/p&gt;&lt;p&gt;I have setup&amp;nbsp;7 fields, one for each day of the week, to pull the day of the week from the date picker.&amp;nbsp;&amp;nbsp;I have rules&amp;nbsp;on each one to determine if it contains a 1 or 16.&lt;/p&gt;&lt;p&gt;I&amp;nbsp;have another&amp;nbsp;field to determine if the start date is a Sunday.&amp;nbsp;&amp;nbsp;If it equals&amp;nbsp;0 its a Sunday.&amp;nbsp;If it doesn&amp;#39;t equal 0 then hide the timesheet.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Has anyone&amp;nbsp;done something like this before?&amp;nbsp; Maybe I need to take a new direction?&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>