<?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>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Using query result to populate fields - multiple results causing error</title><link>https://www.infopathdev.com:443/forums/thread/75266.aspx</link><pubDate>Tue, 14 Feb 2012 22:00:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:75266</guid><dc:creator>Alex A</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/75266.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=75266</wfw:commentRss><description>&lt;p&gt;The idea -- I&amp;#39;m using Infopath in a customer service area to gather data for transactions that are to be completed for the customers.&amp;nbsp; The form is submitting to a Sharepoint list (on which later iterations will allow us to sign/approve transactions electronically, so it will be built out to include workflows for approval and processing), and what I&amp;#39;m trying to do is to build a search function into the form that will pre-fill the client information based on previous transactions.&amp;nbsp; For instance, the CSR will input the client account number, and the query will go to the list to find the client&amp;#39;s account name and address to pre-fill the form.&amp;nbsp; So, the sequence I&amp;#39;m shooting for is:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div&gt;Input search criteria&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Click on button control to query the SP list&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;
&lt;div&gt;Based on filters on the list, set the field values on the Client Name &amp;amp; Address fields&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;For any search that has a single result, I don&amp;#39;t have any problems, the information is filling in to the appropriate fields.&amp;nbsp; The problem that I&amp;#39;m having is that I want to pull the Client Name and Client Address information from the first entry in the SP list that matches the account number.&amp;nbsp; However, as there are multiple entries in the list for that account number, I&amp;#39;m getting the following error:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;nbsp;&lt;strong&gt;An error occurred in the form&amp;#39;s rules or code. The number of rule actions or the number of calls to the OnAfterChange event for a single update in the data exceeded the maximum limit.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The rules or code may be causing an infinite loop. To prevent this, ensure that the rule action or event handler does not update the data which causes the same rule action or event handler to execute.&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Here is the xPath for the query, with the filters that I built in (which are effective if there is only one entry for the query item, but causes the error if there are multiple occurrances):&lt;/p&gt;
&lt;p&gt;xdXDocument:GetDOM(&amp;quot;&lt;strong&gt;DATASOURCE&lt;/strong&gt;&amp;quot;)/dfs:myFields/dfs:dataFields/dfs:&lt;strong&gt;DATASOURCE&lt;/strong&gt;/@Debit_Acct_Title[../@&lt;strong&gt;ACCOUNTNUMBER&lt;/strong&gt; = xdXDocument:get-DOM()/my:wireData/my:TopSection/my:SearchGroup/my:SearchByAccountNumber]&lt;/p&gt;
&lt;p&gt;So, what condition would I need to write into this in order to force the search to populate the appropriate data fields based only on the first hit on that piece of information?&lt;/p&gt;
&lt;p&gt;Thanks for any help!&lt;/p&gt;
&lt;p&gt;AA&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>