<?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: Count specific dates in a list don't work</title><link>https://www.infopathdev.com:443/forums/thread/58038.aspx</link><pubDate>Mon, 16 Aug 2010 13:21:02 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:58038</guid><dc:creator>Michael Vasquez</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/58038.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=58038</wfw:commentRss><description>&lt;p&gt;I tried the count function and it did not work on a Web based form.&amp;nbsp; Can&amp;#39;t get the eval to work either.&amp;nbsp; Not sure how to use it.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;</description></item><item><title>Re: Count specific dates in a list don't work</title><link>https://www.infopathdev.com:443/forums/thread/57868.aspx</link><pubDate>Wed, 11 Aug 2010 07:43:36 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57868</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57868.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=57868</wfw:commentRss><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;You don&amp;#39;t need code to do this. You can use xpath (InfoPath&amp;#39;s macro language) and the eval command. Microsoft&amp;#39;s InfoPath blog had an article about 2 years ago on the eval(eval(....)) method. It&amp;#39;s pretty cool and we even have it in one of our InfoPath training labs. Send me email if you can&amp;#39;t google it. &lt;/p&gt;
&lt;p&gt;Best of luck&lt;/p&gt;
&lt;p&gt;PS&amp;gt; there&amp;#39;s also&amp;nbsp;a count function which could be easier. :)&lt;/p&gt;</description></item><item><title>Count specific dates in a list don't work</title><link>https://www.infopathdev.com:443/forums/thread/57696.aspx</link><pubDate>Thu, 05 Aug 2010 18:10:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:57696</guid><dc:creator>Michael Vasquez</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/57696.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=57696</wfw:commentRss><description>&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;"&gt;I have created a form that schedules the end user to attend a SharePoint Training Class.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;The total amount of persons per class is ten.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;The class is held every Friday.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;What I have done with the InfoPath form is to connect to a data connection on the server and itinerate through all the dates beginning with the next scheduled Friday&amp;#39;s class and count how many people are scheduled for that specific date.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;Two things will occur.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;I will get the next schedule class seat number and also how many seats are available for the class (see code below).&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;"&gt; 
&lt;p&gt;&lt;br /&gt;Dim xPath As XPathNavigator = DataSources(&amp;quot;SharePoint Training&amp;quot;).CreateNavigator()&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;Where form is submitted&lt;br /&gt;Dim ns As XmlNamespaceManager = Me.NamespaceManager&lt;br /&gt;Dim SeatIter As XPathNodeIterator = xPath.Select(&amp;quot;/dfs:myFields/dfs:dataFields/dfs:SharePoint_Training/@Seat__&amp;quot;, ns)&amp;nbsp; &amp;#39;Get list of seat numbers&lt;br /&gt;Dim classDate As XPathNodeIterator = xPath.Select(&amp;quot;/dfs:myFields/dfs:dataFields/dfs:SharePoint_Training/@Class_Date&amp;quot;, ns) &amp;#39;Get list of class dates&lt;br /&gt;Dim xForm As XPathNavigator = Me.CreateNavigator()&lt;br /&gt;Dim formClassDate As String = CStr(xForm.SelectSingleNode(&amp;quot;/my:SharePointTraining/my:dClassDate&amp;quot;, ns).Value)&lt;br /&gt;Dim seatNum As XPathNavigator = xForm.SelectSingleNode(&amp;quot;/my:SharePointTraining/my:seat&amp;quot;, ns)&lt;br /&gt;Dim availSeats As XPathNavigator = xForm.SelectSingleNode(&amp;quot;/my:SharePointTraining/my:AvailSeats&amp;quot;, ns)&lt;br /&gt;Dim cnt As Integer&lt;br /&gt;Dim dClassDate As String&lt;br /&gt;Dim sCnt As String&lt;/p&gt;While (SeatIter.MoveNext())&lt;br /&gt;classDate.MoveNext()&lt;br /&gt;dClassDate = Left(classDate.Current.Value, 10)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:11pt;COLOR:#00b050;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:11pt;COLOR:#00b050;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;
&lt;p class="MsoNoSpacing" style="MARGIN:0in 0in 0pt;"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#00b050;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#00b050;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;‘If the date on the form equals the date from the data connection (SharePoint_Training), count it&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNoSpacing" style="MARGIN:0in 0in 0pt;"&gt;&lt;span style="FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;"&gt;&lt;span style="COLOR:#00b050;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#00b050;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If formClassDate = dClassDate Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt = cnt + 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#00b050;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;‘If the date on the form is greater than the date from the data connection (SharePoint_Training) (old date) then add one to the count, which will be the next &lt;br /&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;‘seat number and then exit the while loop&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If formClassDate &amp;gt; dClassDate Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cnt = cnt + 1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Exit While&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;End While&lt;/p&gt;
&lt;p&gt;&amp;nbsp;If cnt &amp;gt; 0 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#00b050;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;‘Set the value of the seat numbeer&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; seatNum.SetValue(CStr(cnt))&lt;br /&gt;&amp;nbsp;End If&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#00b050;LINE-HEIGHT:115%;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt;‘Set the value of the available seats&lt;/span&gt;&lt;br /&gt;&amp;nbsp;sCnt = CStr(11 – cnt)&lt;br /&gt;&amp;nbsp;availSeats.SetValue(sCnt)&lt;/p&gt;
&lt;p&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;"&gt;Why&amp;nbsp;does the above code only works in InfoPath and not on the InfoPath Web form.&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;If there is one person scheduled for this week’s class the InfoPath will output the next seat number (2) and output the available seats (9).&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;The InfoPath Web form outputs seat number (1) and outputs the available seats&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;(10).&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoPlainText" style="MARGIN:0in 0in 0pt;"&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;"&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;"&gt;Mike V&lt;/span&gt;</description></item></channel></rss>