<?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: Sort text based on Multi-select choices</title><link>https://www.infopathdev.com:443/forums/thread/84730.aspx</link><pubDate>Mon, 26 Nov 2012 15:53:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:84730</guid><dc:creator>dmbach</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/84730.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=84730</wfw:commentRss><description>&lt;p&gt;Thanks, Patrick. Unfortunately, this form is for my employer, and they don&amp;#39;t allow downloading any software. So, Qdabra is out of scope. But I will try the searches you suggested. I appreciate your help! :7)&lt;/p&gt;</description></item><item><title>Re: Sort text based on Multi-select choices</title><link>https://www.infopathdev.com:443/forums/thread/84700.aspx</link><pubDate>Sat, 24 Nov 2012 18:56:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:84700</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/84700.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=84700</wfw:commentRss><description>&lt;p&gt;Hi DMBach and welcome,&lt;/p&gt;&lt;p&gt;I don&amp;#39;t recommend the code you attached because it concatenates the values. Certainly, you don&amp;#39;t need it since you can just use an InfoPath rule and eval(eval(concat(...))) to do the same thing without code.&lt;/p&gt;&lt;p&gt;What I do recommend is to insert the values into a separate &amp;quot;selected&amp;quot; table and then sort that table.&lt;/p&gt;&lt;p&gt;Qdabra (sponsor for this site) has a common library called qRules which supports both insert and sort (and over 120 other functions that could help you). I recommend installing a trial of that and looking at all of the online documentation and detailed user guide. It&amp;#39;s very inexpensive too - probably the equivalent of 4-5 hours of your time but will save you hundreds of hours and you get our time too.&lt;/p&gt;&lt;p&gt;Another idea: InfoPath 2003 has a sample called Asset Tracker with built in sort functionality. It&amp;#39;s written in javascript though, but you could probably easily port it to VB or C# .NET. Still, it would probably take you 5-10 hours and you still wouldn&amp;#39;t have insert. &lt;/p&gt;&lt;p&gt;Yet another idea: there are hundreds of posts in this forum that have coding snippets in them. You could search for insert and sort and probably find some code samples. &lt;/p&gt;&lt;p&gt;Whatever path you take, may you have a delightful journey,&lt;/p&gt;&lt;p&gt;P&lt;/p&gt;</description></item><item><title>Sort text based on Multi-select choices</title><link>https://www.infopathdev.com:443/forums/thread/84581.aspx</link><pubDate>Tue, 20 Nov 2012 17:28:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:84581</guid><dc:creator>dmbach</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/84581.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=84581</wfw:commentRss><description>&lt;p&gt;I have an InfoPath 2007&amp;nbsp;form with a multi-select list box control. I&amp;#39;m using the following code to capture the selections made by the user into a text field:&lt;/p&gt;
&lt;p&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;public&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; CSI_Announcement_Target_Changed(&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;object&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sender, &lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XmlEventArgs&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; e)&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; root = MainDataSource.CreateNavigator();&lt;br /&gt;&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;XPathNodeIterator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; iter = root.Select(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;//my:CSI_Announcement_Target&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;,&lt;br /&gt;NamespaceManager);&lt;br /&gt;System.Text.&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;StringBuilder&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; sb = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; System.Text.&lt;/font&gt;&lt;font color="#008080" size="2"&gt;&lt;font color="#008080" size="2"&gt;StringBuilder&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;();&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;while&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (iter.MoveNext())&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; value = iter.Current.Value;&lt;br /&gt;sb.Append(value);&lt;br /&gt;sb.Append(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;; &amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;);&lt;br /&gt;}&lt;br /&gt;root.SelectSingleNode(&lt;/font&gt;&lt;font color="#800000" size="2"&gt;&lt;font color="#800000" size="2"&gt;&amp;quot;//my:CSI_Announcement_Concat&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;,&lt;br /&gt;NamespaceManager).SetValue(sb.ToString());&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;I&amp;#39;d like the selected values to sort alphabetically, but they&amp;#39;re currently sorted in the order in which they are selected (because of the Append coding). I&amp;#39;m not too familiar with writing C# code. I found this code online. It seems logical that there would be a way to do this, but I&amp;#39;ve not had any luck finding anything that works. I&amp;#39;ve tried populating a repeating table and sorting the rows, but I couldn&amp;#39;t get that to work. I also found something about using workflows, but my experience with workflows is that they&amp;#39;re temperamental. Is there anyone out there that is familiar enough with C# coding that they could maybe revise the above code so it will sort alphabetically as selections are made? Or is there a set of rules I could use to get the values to sort before submitting?&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Thank you!&lt;/p&gt;&lt;/font&gt;</description></item></channel></rss>