<?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>Controls</title><link>https://www.infopathdev.com:443/forums/43.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Using COUNT to detect duplicate People Picker entries</title><link>https://www.infopathdev.com:443/forums/thread/109092.aspx</link><pubDate>Fri, 06 Jan 2017 23:24:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:109092</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/109092.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=109092</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Sorry, I ran out of time to repro this - I&amp;#39;d suggest you run through the code in debug if you aren&amp;#39;t already to see what&amp;#39;s going on - I&amp;#39;m curious about why you are resetting the previous participant id and name to blank on the value change operation, and why you have e.Site.MoveToNext(); in the insert case? One thing that may also help is to drag the people picker fields onto the form as a repeating table &amp;amp; see what the values in the various fields are.&lt;/p&gt;</description></item><item><title>Re: Using COUNT to detect duplicate People Picker entries</title><link>https://www.infopathdev.com:443/forums/thread/109091.aspx</link><pubDate>Fri, 06 Jan 2017 22:20:16 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:109091</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/109091.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=109091</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Oh, I see - yah, if you just want to cancel their change if any exist already, then the changing event should be fine (and probably more straightforward than trying to set the people picker back to the original value). BUT what I think is happening is that the people picker is probably special - when the value changes, the control probably deletes the entire pc:Person node and adds a new one (thus no old value / new value). So - for your current approach, perhaps you need to also store / set the display name field, not just the account ID (whoops, I see now you are doing that .... ). Let me set up a quick repro and see if I have any other bright ideas. :)&lt;/p&gt;</description></item><item><title>Re: Using COUNT to detect duplicate People Picker entries</title><link>https://www.infopathdev.com:443/forums/thread/109085.aspx</link><pubDate>Fri, 06 Jan 2017 18:48:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:109085</guid><dc:creator>Josee Sevigny</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/109085.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=109085</wfw:commentRss><description>&lt;p&gt;Hi, &lt;/p&gt;

&lt;p&gt;Sorry I had to jump on something else yesterday.&lt;/p&gt;

&lt;p&gt;I used the _Changing event as it&amp;#39;s the only one of the 3 that has an e.CancelableArgs (which I think I need?!).&lt;/p&gt;

&lt;p&gt;Ideally, what I want is prevent duplicate participants, no matter what&amp;nbsp;role they play in the process. I haven&amp;#39;t been able to create a validation rule because I&amp;#39;m dealing with people pickers, so obviously some user feedback is desirable, which I could do through MessageBox.Show. So I rewrote my method as follows and it works ONCE. &lt;/p&gt;&lt;p&gt;Sequence: I had Person A, B and C as participants. Change Person C for person A. fires the error and resets to C. Change for person B and error does not come up.&lt;/p&gt;

&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;
&lt;p&gt;&lt;font size="1"&gt;&lt;font size="1"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;&lt;font color="#0000ff" face="Consolas" size="2"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt; prevParticipantId = &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt;.Empty;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt; prevParticipantName = &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;string&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt;.Empty;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;&lt;p&gt;public void participant_AccountId_Changed(object sender, XmlEventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;XPathNavigator xn = this.MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp;switch (e.Operation)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;case XmlOperation.Delete:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prevParticipantId = e.Site.Value.Trim();&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;prevParticipantName = e.Site.SelectSingleNode(&amp;quot;../pc:DisplayName&amp;quot;, NamespaceManager).Value.Trim();&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/p&gt;
&lt;/font&gt;

&lt;p&gt;&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;&amp;nbsp;&amp;nbsp;case XmlOperation.Insert:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; XPathNodeIterator xni = xn.Select(&amp;quot;//my:review[my:reviewRequired = 1 and (my:ppicker/pc:Person/pc:AccountId = &amp;#39;&amp;quot; + e.Site.Value.Trim() + &amp;quot;&amp;#39;)]&amp;quot;, NamespaceManager);&lt;/font&gt;&lt;/p&gt;
&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;if (xni.Count &amp;gt; 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; MessageBox.Show(&amp;quot;This person is already in use. Please try again.&amp;quot; );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; e.Site.SetValue(prevParticipantId);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Site.SelectSingleNode(&amp;quot;../pc:DisplayName&amp;quot;, NamespaceManager).SetValue(prevParticipantName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.Site.MoveToNext();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/font&gt;&lt;/p&gt;
&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;&amp;nbsp;&amp;nbsp;case XmlOperation.ValueChange:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;prevParticipantId = string.Empty;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;prevParticipantName = string.Empty;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/font&gt;&lt;/p&gt;
&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;
&lt;/font&gt;
&lt;p&gt;&lt;font color="#0000cc" face="courier new,courier" size="1"&gt;&amp;nbsp;&amp;nbsp;default:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;
&amp;nbsp;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Using COUNT to detect duplicate People Picker entries</title><link>https://www.infopathdev.com:443/forums/thread/109042.aspx</link><pubDate>Wed, 04 Jan 2017 23:00:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:109042</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/109042.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=109042</wfw:commentRss><description>This is on the changing event - I&amp;#39;d use the changed event, unless you want to instead throw a validation error (in which case you&amp;#39;d use the validating event...)? I guess I should clarify - what exactly do you want to have happen if the user selects someone who has already been selected? Set the people picker back to blank? Have a validation error? Something else? :)</description></item><item><title>Re: Using COUNT to detect duplicate People Picker entries</title><link>https://www.infopathdev.com:443/forums/thread/109041.aspx</link><pubDate>Wed, 04 Jan 2017 22:54:08 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:109041</guid><dc:creator>Josee Sevigny</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/109041.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=109041</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi Hilary,&amp;nbsp;&amp;nbsp;Happy New Year to you too! ;-)&lt;/p&gt;
&lt;p&gt;So I wrote to following for 1 of the participant (which I&amp;#39;ll extend to the rest of them once it works properly).&amp;nbsp; It works fine except that:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;I&amp;#39;m not seeing any error message/prompt.&lt;/li&gt;&lt;li&gt;The People Picker is no longer editable.&lt;/li&gt;&lt;li&gt;The previous value is gone (hence why I was after the e.OldValue)&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br /&gt;public void leadEngPartner_review_ppicker_Person_AccountId_Changing(object sender, XmlChangingEventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;if (e.Operation == XmlOperation.Insert)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;XPathNavigator xn = this.MainDataSource.CreateNavigator();&lt;br /&gt;&amp;nbsp;&amp;nbsp;XPathNodeIterator xni = xn.Select(&amp;quot;//my:review[my:reviewRequired = 1 and (my:ppicker/pc:Person/pc:AccountId = &amp;#39;&amp;quot; + e.Site + &amp;quot;&amp;#39;)]&amp;quot;, NamespaceManager);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;if (xni.Count &amp;gt; 1)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.CancelableArgs.Message = &amp;quot;This person is used more than once. All reviewers must be unique.&amp;quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;e.CancelableArgs.Cancel = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;}&lt;/p&gt;</description></item><item><title>Re: Using COUNT to detect duplicate People Picker entries</title><link>https://www.infopathdev.com:443/forums/thread/109039.aspx</link><pubDate>Wed, 04 Jan 2017 20:52:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:109039</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/109039.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=109039</wfw:commentRss><description>&lt;p&gt;Hiya - happy New Year! You can ensure your code only runs on insert by checking the Operation:&lt;/p&gt;&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;&lt;p&gt;if (e.Operation == XmlOperation.Insert)&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&amp;nbsp;then proceed from there. You want the NewValue of the node, not the old value - but you may just want to run the code on the change of the AccountId, not the Person group (since when the fields change inside the Person group, I imagine events are firing on that group). Generally, I would just use a changed event - unless you want to throw a validation error if the user has already been selected for a different role?&lt;/p&gt;</description></item><item><title>Using COUNT to detect duplicate People Picker entries</title><link>https://www.infopathdev.com:443/forums/thread/109038.aspx</link><pubDate>Wed, 04 Jan 2017 20:29:14 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:109038</guid><dc:creator>Josee Sevigny</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/109038.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=109038</wfw:commentRss><description>&lt;p&gt;Considering the following structure: /my:myFields/my:participants/my:*/my:review/my:ppicker/pc:Person&lt;/p&gt;&lt;p&gt;I&amp;#39;m trying to detect any duplicate people among my:participants. &amp;nbsp;So when I enter a name in any particular People Picker, I&amp;#39;d like to validate that it is unique among the set.&lt;br /&gt;I tried the Changing, Validating, and Changed events but they get fired twice; once for the Delete operation and once more for the Insert operation never showing the e.OldValue...&lt;/p&gt;&lt;p&gt;my:paticipants is non-repeating.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>