<?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: XPath and eval()</title><link>https://www.infopathdev.com:443/forums/thread/14782.aspx</link><pubDate>Tue, 12 Sep 2006 19:25:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14782</guid><dc:creator>jrshrenk</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14782.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14782</wfw:commentRss><description>Resolved:&lt;br /&gt;&lt;br /&gt;I ended up just going the code route.  I used a for loop to loop through each individual and pick up their matrix_assignment_code.  Within the for loop is a switch/case structure that concatenates the fields I need.  Outside the for loop I then assign each variable to a different input box.  &lt;br /&gt;&lt;br /&gt;This ends up working out better as it properly interprets \n as a new line in the text box and I get to skip over the extra XML file for ASCII codes.&lt;br /&gt;&lt;br /&gt;Here's the code for those interested:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;function popBox() {&lt;br /&gt;&lt;br /&gt;	var total_rows = XDocument.DOM.selectSingleNode("/my:allTeams/my:myTeam/my:associates/my:assoc_count").text;&lt;br /&gt;	var sq_kc = ""&lt;br /&gt;	for ( var i = 1; i &amp;lt;= total_rows; i++ ) {&lt;br /&gt;		var getCurrent = i&lt;br /&gt;		var node = "/my:allTeams/my:myTeam/my:associates/my:individual[" + getCurrent + "]/my:profile/my:name";&lt;br /&gt;		var r = XDocument.DOM.selectSingleNode(node).text;&lt;br /&gt;		var node2 = "/my:allTeams/my:myTeam/my:associates/my:individual[" + getCurrent + "]/my:profile/my:matrix_assignment_code";&lt;br /&gt;		var s = XDocument.DOM.selectSingleNode(node2).text;&lt;br /&gt;		var node3 = "/my:allTeams/my:myTeam/my:associates/my:individual[" + getCurrent + "]/my:profile/my:title";&lt;br /&gt;		var t = XDocument.DOM.selectSingleNode(node3).text;&lt;br /&gt;		switch(s) {&lt;br /&gt;			case "kc": sq_kc += i + r + " -- " + t + "\n"; break;&lt;br /&gt;			case "ap1": sq_kc += i + r + " -- " + t + "\n"; break;&lt;br /&gt;&lt;br /&gt;                        ...&lt;br /&gt;&lt;br /&gt;			default: break;&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;	var kcNode = "/my:allTeams/my:myTeam/my:kc";&lt;br /&gt;	var kcVal = XDocument.DOM.selectSingleNode(kcNode);&lt;br /&gt;	kcVal.text = sq_kc;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks for your help Shiva!  I ultimately just needed to give up on the direction I was trying to go (even though I felt like it was so close to working).&lt;br /&gt;&lt;br /&gt;James</description></item><item><title>Re: XPath and eval()</title><link>https://www.infopathdev.com:443/forums/thread/14781.aspx</link><pubDate>Mon, 11 Sep 2006 23:59:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14781</guid><dc:creator>jrshrenk</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14781.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14781</wfw:commentRss><description>Hi Shiva,&lt;br /&gt;&lt;br /&gt;Here are the results of breaking up the statements:&lt;br /&gt;&lt;br /&gt;&lt;font face="Courier New"&gt;&lt;b&gt;../my:associates/my:individual[my:profile/my:matrix_assignment_code = 'kc']&lt;/b&gt;&lt;/font id="Courier New"&gt;&lt;br /&gt;&lt;br /&gt;The statement above validates without any problem.&lt;br /&gt;&lt;br /&gt;&lt;font face="Courier New"&gt;&lt;b&gt;concat(my:profile/my:name, xdXDocument:GetDOM("characters")/characters/@cr)&lt;/b&gt;&lt;/font id="Courier New"&gt;&lt;br /&gt;&lt;br /&gt;This statement did not immediately validate (I believe it lost the context node).  I changed it to:&lt;br /&gt;&lt;br /&gt;&lt;font face="Courier New"&gt;&lt;b&gt;concat(../my:associates/my:individual/my:profile/my:name, xdXDocument:GetDOM("characters")/characters/@cr)&lt;/b&gt;&lt;/font id="Courier New"&gt;&lt;br /&gt;&lt;br /&gt;... and it validated correctly.  Upon combining the two back into the Eval() function, it gave the same MSXML5.DLL errors indicating the same "undeclared namespace prefix my:".</description></item><item><title>Re: XPath and eval()</title><link>https://www.infopathdev.com:443/forums/thread/14780.aspx</link><pubDate>Mon, 11 Sep 2006 18:15:46 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14780</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14780.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14780</wfw:commentRss><description>Hi James,&lt;br /&gt;&lt;br /&gt;You need to test above two Xpath's are correct or not. &lt;br /&gt;1.	You need to confirm first xpath is “&lt;b&gt;../my:associates/my:individual[my:profile/my:matrix_assignment_code = 'kc']&lt;/b&gt;”. You need to try this xpath in some other text box or same text path is it giving value or not.&lt;br /&gt;2.	You need to test second xpath is “&lt;b&gt;concat(my:profile/my:name, xdXDocument:GetDOM("characters")/characters/@cr)&lt;/b&gt;”.&lt;br /&gt;&lt;br /&gt;Then above two cases is correct then Eval function also gives the correct value.&lt;br /&gt;</description></item><item><title>Re: XPath and eval()</title><link>https://www.infopathdev.com:443/forums/thread/14779.aspx</link><pubDate>Mon, 11 Sep 2006 14:15:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14779</guid><dc:creator>jrshrenk</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14779.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14779</wfw:commentRss><description>Hi Shiva,&lt;br /&gt;&lt;br /&gt;It is the inner Eval() that is causing errors.  Here's the edited XPath.  It creates the same error:&lt;br /&gt;&lt;br /&gt;&lt;font face="Courier New"&gt;xdMath:Eval(../my:associates/my:individual[my:profile/my:matrix_assignment_code = 'kc'], 'concat(my:profile/my:name, xdXDocument:GetDOM("characters")/characters/@cr)')&lt;/font id="Courier New"&gt;&lt;br /&gt;&lt;br /&gt;Nonetheless, as a curiosity, I removed the &lt;font face="Courier New"&gt;kc&lt;/font id="Courier New"&gt; from the XPath and it returns no errors (but also will not accomplish my goal.&lt;br /&gt;&lt;br /&gt;Thoughts?&lt;br /&gt;&lt;br /&gt;James</description></item><item><title>Re: XPath and eval()</title><link>https://www.infopathdev.com:443/forums/thread/14778.aspx</link><pubDate>Mon, 11 Sep 2006 06:30:15 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14778</guid><dc:creator>Shiva</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14778.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14778</wfw:commentRss><description>Hi jrshrenk,&lt;br /&gt;&lt;br /&gt;Eval function returns the values of a set of fields. The first argument defines the set of fields; the second argument defines the expression to calculate for the set of fields. Usually, the eval function is nested within a function that operates on a set of fields, such as sum or avg.&lt;br /&gt;&lt;br /&gt;In your XPath:&lt;br /&gt;xdMath:Eval(&lt;b&gt;xdMath:Eval(../my:associates/my:individual[my:profile/my:matrix_assignment_code = 'kc'], 'concat(my:profile/my:name, xdXDocument:GetDOM("characters")/characters/@cr)')&lt;/b&gt;, "..")&lt;br /&gt;&lt;br /&gt;Can you check with second eval function works correctly or not then you need to test first eval function. Because of we can find out which function is works correctly.&lt;br /&gt;</description></item><item><title>XPath and eval()</title><link>https://www.infopathdev.com:443/forums/thread/12941.aspx</link><pubDate>Fri, 08 Sep 2006 17:25:57 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12941</guid><dc:creator>jrshrenk</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12941.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12941</wfw:commentRss><description>Hello,&lt;br /&gt;&lt;br /&gt;First off, many thanks to the site maintainers and InfoPath experts who have already (unknowingly) helped me on dozens of issues that I've had so far.  These forums and tutorials are invaluable.&lt;br /&gt;&lt;br /&gt;That said, I have come across an issue that I'm afraid I've run out of resources to try to fix.  Here's the setup:&lt;br /&gt;&lt;br /&gt;I have a repeating table that keeps a list of individuals (and is used throughout the form).  On one view, the form user is asked to assign each individual to one square in a nine square box (via radio button).  I have then been asked to create a print view of that nine square box that lists out the names of the individuals assigned to each of the boxes.  Each of those names should be a separate line.&lt;br /&gt;&lt;br /&gt;Based on &lt;a href='http://blogs.msdn.com/infopath/archive/2006/04/05/569338.aspx' target='_blank' title='http://blogs.msdn.com/infopath/archive/2006/04/05/569338.aspx'&lt;a target="_blank" href=http://blogs.msdn.com/infopath/archive/2006/04/05/569338.aspx&gt;http://blogs.msdn.com/infopath/archive/2006/04/05/569338.aspx&lt;/a&gt;&lt;/a&gt;, I have managed to get as far as creating a list of all individuals.  My next step is to filter the full list of individuals and display only those individuals that were selected for the single square.&lt;br /&gt;&lt;br /&gt;In a text box, I have the following code (which does not filter at all):&lt;br /&gt;&lt;br /&gt;&lt;font face="Courier New"&gt;xdMath:Eval(xdMath:Eval(../my:associates/my:individual, 'concat(my:profile/my:name, xdXDocument:GetDOM("characters")/characters/@cr)'), "..")&lt;/font id="Courier New"&gt;&lt;br /&gt;&lt;br /&gt;In order to filter, I used the following:&lt;br /&gt;&lt;br /&gt;&lt;font face="Courier New"&gt;xdMath:Eval(xdMath:Eval(../my:associates/my:individual[my:profile/my:matrix_assignment_code = 'kc'], 'concat(my:profile/my:name, xdXDocument:GetDOM("characters")/characters/@cr)'), "..")&lt;/font id="Courier New"&gt;&lt;br /&gt;&lt;br /&gt;This causes an error:&lt;br /&gt;&lt;br /&gt; &lt;blockquote id="quote"&gt;&lt;font size="1" face="Verdana, Arial, Helvetica" id="quote"&gt;quote:&lt;hr height="1" noshade id="quote"&gt;MSXML5.DLL&lt;br /&gt;Reference to undeclared namespace prefix: 'my'.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Error occurred during a call to property or method 'Eval'.&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;&lt;br /&gt;If I remove the "kc" and simply have it check for the existance of the node (or that it is empty), the formula verifies properly, but of course, it no longer filters the names as required.&lt;br /&gt;&lt;br /&gt;So the question.... is what I need to do possible with the way I'm using eval()?  It seems like eval() places some restrictions on how filtering can be done (or it's just buggy--but I would never presume).  Alternatively, should I just use code to do this and quit trying to turn a text box into a nuclear reactor?&lt;br /&gt;&lt;br /&gt;Any suggestions or explanations would be helpful.  Thanks!</description></item></channel></rss>