<?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: Turning Repeating Table values into a sentence.</title><link>https://www.infopathdev.com:443/forums/thread/80579.aspx</link><pubDate>Fri, 13 Jul 2012 16:59:37 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:80579</guid><dc:creator>Anson Hidajat</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/80579.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=80579</wfw:commentRss><description>This is awesome!&amp;nbsp; Will definitely use this in the future.&amp;nbsp; Thanks for sharing :)</description></item><item><title>Turning Repeating Table values into a sentence.</title><link>https://www.infopathdev.com:443/forums/thread/80493.aspx</link><pubDate>Thu, 12 Jul 2012 14:13:41 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:80493</guid><dc:creator>dustbin111</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/80493.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=80493</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m trying to turn a list of attendees in a repeating table into a thank you sentence.&lt;/p&gt;
&lt;p&gt;For examples, the values in the repeating table look like:&lt;/p&gt;
&lt;p&gt;Jim&lt;br /&gt;Tim&lt;br /&gt;Lisa&lt;br /&gt;Fred&lt;/p&gt;
&lt;p&gt;I need the sentence to say:&lt;/p&gt;
&lt;p&gt;&amp;quot;Special Thanks to Jim, Tim, Lisa, and Fred.&amp;quot;&lt;/p&gt;
&lt;p&gt;Consider the following repeating table structure:&lt;/p&gt;
&lt;p&gt;groupAttendees&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; groupAttendee&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldAttendeeName&lt;/p&gt;
&lt;p&gt;I could create the sentence &amp;quot;Special thanks to Jim, Tim, Lisa, Fred, &amp;quot; all day using nested evals:&lt;/p&gt;
&lt;p&gt;concat(&amp;quot;Special thanks to &amp;quot;, eval(eval(groupAttendee, &amp;#39;concat(my:fieldAttendeeName, &amp;quot;, &amp;quot;)&amp;#39;), &amp;quot;..&amp;quot;))&lt;/p&gt;
&lt;p&gt;However this does not give me the desired result with the &amp;quot;and&amp;quot; before the last table entry.&amp;nbsp; I searched around and could not find a way to enter the &amp;quot;and&amp;quot; in the sentence just before the last table entry.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;So here&amp;#39;s my thought process:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;1) Assign a Line Item number to each table entry.&lt;br /&gt;2) Count the number of rows in the table.&lt;br /&gt;3) If the line number is less than the row count, concat a string&lt;br /&gt;4) If the line number is equal to the row count, concat the and string&lt;br /&gt;5) concat the two strings together&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Implementation:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1)&lt;/strong&gt; Assign a Line Item number to each table entry.&lt;/p&gt;
&lt;p&gt;Modified repeating table structure by adding fieldAttendeeLineItem:&lt;/p&gt;
&lt;p&gt;groupAttendees&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; groupAttendee&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldAttendeeName&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fieldAttendeeLineItem&lt;/p&gt;
&lt;p&gt;assigned fieldAttendeeLineItem default value of:&lt;/p&gt;
&lt;p&gt;count(../preceding-sibling::*) + 1&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2)&lt;/strong&gt; Count the number of rows in the table.&lt;/p&gt;
&lt;p&gt;created a field outside the repeating table named fieldRowCount with a Default value of:&lt;/p&gt;
&lt;p&gt;count(groupAttendee)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3)&lt;/strong&gt; If the line number is less than the row count, concat a string&lt;/p&gt;
&lt;p&gt;eval(eval(groupAttendee[msxsl:string-compare(fieldAttendeeLineItem, fieldRowCount) &amp;lt; 0], &amp;#39;concat(my:fieldAttendeeName, &amp;quot;, &amp;quot;)&amp;#39;), &amp;quot;..&amp;quot;)&lt;/p&gt;
&lt;p&gt;The results of such a string would be:&lt;/p&gt;
&lt;p&gt;Jim, Tim, Lisa, &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4)&lt;/strong&gt; If the line number is equal to the row count, concat the &amp;quot;and&amp;quot; string&lt;/p&gt;
&lt;p&gt;eval(eval(groupAttendee, &amp;#39;concat(&amp;quot;and &amp;quot;, my:fieldAttendeeName[../my:fieldAttendeeLineItem = ../../../my:fieldRowCount], &amp;quot;.&amp;nbsp; &amp;quot;)&amp;#39;), &amp;quot;..&amp;quot;)&lt;/p&gt;
&lt;p&gt;The results of such a string would be:&lt;/p&gt;
&lt;p&gt;and Fred.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;5)&lt;/strong&gt; concat the two strings together&lt;/p&gt;
&lt;p&gt;created a field outside the repeating table called fieldAttendeeThankYou with the Default Value:&lt;/p&gt;
&lt;p&gt;concat(&amp;quot;Special thanks to &amp;quot;, eval(eval(groupAttendee[msxsl:string-compare(fieldAttendeeLineItem, fieldRowCount) &amp;lt; 0], &amp;#39;concat(my:fieldAttendeeName[../my:fieldAttendeeLineItem &amp;lt; ../../../my:fieldRowCount], &amp;quot;, &amp;quot;)&amp;#39;), &amp;quot;..&amp;quot;), &amp;quot;and &amp;quot;, fieldAttendeeName[fieldAttendeeLineItem = fieldRowCount], &amp;quot;.&amp;nbsp; &amp;quot;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Got what I wanted:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Special thanks to Jim, Tim, Lisa, and Fred. &lt;/p&gt;
&lt;p&gt;I&amp;#39;ll have to add some logic for blank fields, if there is only one name, etc, but you get the idea.&lt;/p&gt;
&lt;p&gt;If anyone has a simpler way, please let me know!&lt;/p&gt;
&lt;p&gt;~Dustin.&lt;/p&gt;</description></item></channel></rss>