<?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: Help a newbie with comparing repeating table field</title><link>https://www.infopathdev.com:443/forums/thread/76361.aspx</link><pubDate>Tue, 13 Mar 2012 17:33:12 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:76361</guid><dc:creator>smitman34</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/76361.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=76361</wfw:commentRss><description>&lt;p&gt;Hi DC, &lt;/p&gt;&lt;p&gt;I&amp;#39;m no expert here either but I think what you need to do is loop through the repeating table.&lt;/p&gt;&lt;p&gt;I&amp;#39;m in a similiar situation and I&amp;#39;m trying this:&lt;/p&gt;&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;DataSource&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; ds = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;this&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;.DataSources[&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;SecondarySourceName&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;];&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNavigator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; NavBTIN = ds.CreateNavigator();&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&gt;

&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;font color="#2b91af" size="2"&gt;XPathNodeIterator&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; rows = NavBTIN.Select(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;Path to your field&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager);&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size="2"&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; (rows.MoveNext())&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;p&gt;            {&lt;/p&gt;&lt;p&gt;if(UserNode == CurrentUser)&lt;br /&gt;		thisXDocument.Role = &amp;quot;Admin&amp;quot;;&lt;br /&gt;	else&lt;br /&gt;		thisXDocument.Role = &amp;quot;Requestor&amp;quot;;&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;The challenge I have is I only want to evaluate on the first occurance in the repeater and then I want to get out.&lt;/p&gt;&lt;p&gt;Maybe this helps you, give it a try.&lt;/p&gt;&lt;p&gt;Maybe you can help me with my problem: &lt;a href="http://www.infopathdev.com/forums/p/22078/76356.aspx#76356"&gt;http://www.infopathdev.com/forums/p/22078/76356.aspx#76356&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;/font&gt;</description></item><item><title>Re: Help a newbie with comparing repeating table field</title><link>https://www.infopathdev.com:443/forums/thread/13530.aspx</link><pubDate>Wed, 07 Sep 2005 01:58:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13530</guid><dc:creator>DC Ross</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13530.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13530</wfw:commentRss><description>Never mind, I realized that the data wasn't being retrieved.&lt;br /&gt;&lt;br /&gt;Thank you very much for your help,&lt;br /&gt;-DC Ross</description></item><item><title>Re: Help a newbie with comparing repeating table field</title><link>https://www.infopathdev.com:443/forums/thread/13529.aspx</link><pubDate>Thu, 01 Sep 2005 17:57:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13529</guid><dc:creator>DC Ross</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13529.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13529</wfw:commentRss><description>Thank you very much for your reply, Greg. I appreciate your help, but...&lt;br /&gt;&lt;br /&gt;I inserted the code you provided, and I'm still getting the same results as I was before - only the first row in the repeating table is being compared.&lt;br /&gt;&lt;br /&gt;Here's the new SetUserRole method:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;public void SetUserRole(string UserAlias)&lt;br /&gt;{&lt;br /&gt;	IXMLDOMNode UserNode = ConfigForm.selectSingleNode("/my:Config/my:Administrators/my:Administrator/my:Admin-Alias[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = '" + UserAlias + "']");&lt;br /&gt;&lt;br /&gt;	if(UserNode != null)&lt;br /&gt;		thisXDocument.Role = "Admin";&lt;br /&gt;	else&lt;br /&gt;		thisXDocument.Role = "Requestor";&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here's a sample of my data:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&amp;lt;my:Config xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-08-17T18:16:54" xml:lang="en-us"&amp;gt;&lt;br /&gt;	&amp;lt;my:Administrators&amp;gt;&lt;br /&gt;		&amp;lt;my:Administrator&amp;gt;&lt;br /&gt;			&amp;lt;my:Admin-FullName&amp;gt;DC Ross&amp;lt;/my:Admin-FullName&amp;gt;&lt;br /&gt;			&amp;lt;my:Admin-Alias&amp;gt;dcross&amp;lt;/my:Admin-Alias&amp;gt;&lt;br /&gt;		&amp;lt;/my:Administrator&amp;gt;&lt;br /&gt;		&amp;lt;my:Administrator&amp;gt;&lt;br /&gt;			&amp;lt;my:Admin-FullName&amp;gt;John Smith&amp;lt;/my:Admin-FullName&amp;gt;&lt;br /&gt;			&amp;lt;my:Admin-Alias&amp;gt;jsmith&amp;lt;/my:Admin-Alias&amp;gt;&lt;br /&gt;		&amp;lt;/my:Administrator&amp;gt;&lt;br /&gt;	&amp;lt;/my:Administrators&amp;gt;&lt;br /&gt;&amp;lt;/my:Config&amp;gt;&lt;/pre&gt;&lt;br /&gt;If John Smith were to view the form, he would be assigned the role of "Requestor", not "Admin".&lt;br /&gt;&lt;br /&gt;Thank you in advance,&lt;br /&gt;-DC Ross</description></item><item><title>Re: Help a newbie with comparing repeating table field</title><link>https://www.infopathdev.com:443/forums/thread/13528.aspx</link><pubDate>Thu, 01 Sep 2005 17:07:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:13528</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/13528.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=13528</wfw:commentRss><description>This is because you are using select"SINGLE"node... which does just that. It selects a "single" node... typically the first one.&lt;br /&gt;&lt;br /&gt;One way around that is to use a filter in your XPath, similar to this:&lt;br /&gt;&lt;br /&gt;IXMLDOMNode User = ConfigForm.selectSingleNode("/my:Config/my:Administrators/my:Administrator/my:Admin-Alias[. = '" + UserAlias + "']");&lt;br /&gt;if(User != null)&lt;br /&gt;    UserNode = User.text.ToLower();&lt;br /&gt;&lt;br /&gt;This will find the first my:Admin-Alias that has a value equal to UserAlias. If null is returned, then no match was found.&lt;br /&gt;&lt;br /&gt;What I'm not accounting for in my example above is for case differences... so if in the XML you have "Foo" and UserAlias is "foo", there won't be a match. You can try using translate() to resolve that... For example, assuming UserAlias is already in all lower-case:&lt;br /&gt;&lt;br /&gt;...my:Admin-Alias[translate(., 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = '" + UserAlias + "']"...&lt;br /&gt;&lt;br /&gt;Good luck!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Greg Collins [InfoPath MVP]&lt;br /&gt;InfoPath Dev</description></item><item><title>Help a newbie with comparing repeating table field</title><link>https://www.infopathdev.com:443/forums/thread/12548.aspx</link><pubDate>Tue, 30 Aug 2005 16:35:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12548</guid><dc:creator>DC Ross</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12548.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12548</wfw:commentRss><description>Hi all,&lt;br /&gt;&lt;br /&gt;I have a repeating table in a secondary data source. What I need to do is compare these values to a known value, and return a boolean result. &lt;br /&gt;&lt;br /&gt;What's happening, is that only the first row in that repeating table is being compared.&lt;br /&gt;&lt;br /&gt;Here's the pertinent code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;private string			CurrentUser;&lt;br /&gt;private IXMLDOMDocument2	ConfigForm;&lt;br /&gt;&lt;br /&gt;public void _Startup(Application app, XDocument doc)&lt;br /&gt;{&lt;br /&gt;	thisXDocument = doc;&lt;br /&gt;	thisApplication = app;&lt;br /&gt;&lt;br /&gt;	CurrentUser = System.Environment.UserName.ToLower();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[InfoPathEventHandler(EventType=InfoPathEventType.OnLoad)]&lt;br /&gt;public void OnLoad(DocReturnEvent e)&lt;br /&gt;{&lt;br /&gt;	CurrentUser = System.Environment.UserName.ToLower();&lt;br /&gt;&lt;br /&gt;	IXMLDOMDocument2 ConfigForm = (IXMLDOMDocument2)thisXDocument.CreateDOM();&lt;br /&gt;	ConfigForm.async = false;&lt;br /&gt;	ConfigForm.load("Config.xml");&lt;br /&gt;	ConfigForm.setProperty("SelectionNamespaces", "xmlns:my=\"http://schemas.microsoft.com/office/infopath/2003/myXSD/2005-08-17T18:16:54\"");&lt;br /&gt;&lt;br /&gt;	SetUserRole(CurrentUser);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public void SetUserRole(string UserAlias)&lt;br /&gt;{&lt;br /&gt;	string UserNode = ConfigForm.selectSingleNode("/my:Config/my:Administrators/my:Administrator/my:Admin-Alias").text.ToLower();&lt;br /&gt;&lt;br /&gt;	if(UserNode == CurrentUser)&lt;br /&gt;		thisXDocument.Role = "Admin";&lt;br /&gt;	else&lt;br /&gt;		thisXDocument.Role = "Requestor";&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I'm pretty new to this InfoPath thing, so go easy on me :)&lt;br /&gt;&lt;br /&gt;Thanks!&lt;br /&gt;-DC Ross</description></item></channel></rss>