<?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: Code to Iterate through Secondary DataSource</title><link>https://www.infopathdev.com:443/forums/thread/35691.aspx</link><pubDate>Thu, 11 Dec 2008 18:57:32 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35691</guid><dc:creator>mjarrett</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35691.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35691</wfw:commentRss><description>&lt;p&gt;Works perfectly! Thank you!&lt;/p&gt;</description></item><item><title>Re: Code to Iterate through Secondary DataSource</title><link>https://www.infopathdev.com:443/forums/thread/35649.aspx</link><pubDate>Thu, 11 Dec 2008 05:39:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35649</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35649.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35649</wfw:commentRss><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;We can hide the section using expression as Jimmy said. If you want you can add one more field in schema and set the value is true for show the section otherwise hide the section. This new field value we have to set in code based on your condition.&lt;/p&gt;</description></item><item><title>Re: Code to Iterate through Secondary DataSource</title><link>https://www.infopathdev.com:443/forums/thread/35640.aspx</link><pubDate>Thu, 11 Dec 2008 00:16:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35640</guid><dc:creator>Jimmy</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35640.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35640</wfw:commentRss><description>&lt;p&gt;Code for this would not require iteration.&amp;nbsp; It would look like this:&lt;/p&gt;&lt;font size="2"&gt;
&lt;blockquote&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; iLoveSharePointSource = DataSources[&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;&lt;strong&gt;GetGroupsFromCurrentUser&lt;/strong&gt;&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;].CreateNavigator();&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; (iLoveSharePointSource.SelectSingleNode(&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&amp;quot;//&lt;strong&gt;s1&lt;/strong&gt;:UserGroups[&lt;strong&gt;s1&lt;/strong&gt;:string = &amp;#39;Human Resources&amp;#39;]&amp;quot;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;, NamespaceManager) != &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;)&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#008000" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // do stuff&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;You might need to change the GetGroupsFromCurrentUser and s1, depending on what those are called in your form.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;But it sounds to me like you just want to show or hide a section, which would be done in&amp;nbsp;conditional formatting, not code.&amp;nbsp; Just hide the section based on this expression:&lt;/font&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;not(xdXDocument:GetDOM(&amp;quot;&lt;strong&gt;GetGroupsFromCurrentUser&lt;/strong&gt;&amp;quot;)//&lt;strong&gt;s1&lt;/strong&gt;:UserGroups[&lt;strong&gt;s1&lt;/strong&gt;:string = &amp;quot;Human Resources&amp;quot;])&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;Again, you may need to adjust the bold parts.&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;</description></item><item><title>Code to Iterate through Secondary DataSource</title><link>https://www.infopathdev.com:443/forums/thread/35616.aspx</link><pubDate>Wed, 10 Dec 2008 17:44:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:35616</guid><dc:creator>mjarrett</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/35616.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=35616</wfw:commentRss><description>&lt;p&gt;Hi all&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I am using ILoveSharePoint&amp;#39;s GetGroupsFromCurrentUser webservice which returns all SharePoint groups that the user is in. Anyhow, this is a secondary datasource. I need help writing the code to iterate through this repeating field. Then, I need to unhide a section based on whether or not they are in the group.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;I have tried to populate a drop-down list with this information&amp;nbsp;and use &amp;quot;Contains&amp;quot;, &amp;quot;Is Equal to&amp;quot;, &amp;quot;is present&amp;quot; to control the conditional formatting but it does not work. &lt;/p&gt;
&lt;p&gt;I was thinking with something along the lines of &amp;lt;pseudo code&amp;gt;:&lt;/p&gt;
&lt;p&gt;foreach(Group in GroupList)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; If (Group == &amp;quot;Human Resources&amp;quot;)&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;&amp;nbsp;&amp;nbsp;&amp;nbsp; show hidden section&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&amp;lt;/pseudo code&amp;gt;&lt;/p&gt;
&lt;p&gt;But I am not very proficient&lt;span style="FONT-SIZE:12pt;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA;"&gt; &lt;/span&gt;with C# and the XPathNavigators and such. Any help would be GREAT! Thanks in advance!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>