<?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: Setting the value of a node</title><link>https://www.infopathdev.com:443/forums/thread/14738.aspx</link><pubDate>Thu, 27 Jul 2006 19:43:00 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14738</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14738.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14738</wfw:commentRss><description>So glad I have helped. Keep up the good work. Perseverance pays off.</description></item><item><title>Re: Setting the value of a node</title><link>https://www.infopathdev.com:443/forums/thread/14737.aspx</link><pubDate>Wed, 26 Jul 2006 21:29:54 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14737</guid><dc:creator>Nara Chilluvuri</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14737.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14737</wfw:commentRss><description>Hi Greg,&lt;br /&gt;&lt;br /&gt;Thanks tons for your help.  Your suggestion did the trick.  I was approaching this totally wrong having not worked with InfoPath too much before.  &lt;br /&gt;&lt;br /&gt;In response to your question,  I was trying to set the 'AllDefects' Attribute in the 'TestExecutionSummary' section.  I realise I was mentioning the structure of the XML wrong and with the following modification it worked fine.&lt;br /&gt;&lt;br /&gt;attrAllDefects = XDocument.DOM.selectSingleNode("/my:TestCaseDocument/my:TestExecutionSummary/my:AllDefects");&lt;br /&gt;attrAllDefects.text = allDefectIDs;&lt;br /&gt;&lt;br /&gt;I should also thank your for all your other posts on this forum.  I have used your suggestions on Auto numbering and couple of other tricks to get started in developing this InfoPath form.&lt;br /&gt;&lt;br /&gt;Cheers&lt;br /&gt;Nara&lt;br /&gt;&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;&lt;i&gt;Originally posted by Greg Collins&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;What attribute are you trying to set?&lt;br /&gt;&lt;br /&gt;Better way to set the attribute value is:&lt;br /&gt;&lt;br /&gt;attrAllDefects = XDocument.DOM.selectSingleNode("/my:TestCaseDocument/my:TestExecutionSummary/my:AllDefects/@my:attributeToSet");&lt;br /&gt;attrAllDefects.text = allDefectIDs;&lt;br /&gt;&lt;br /&gt;&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;</description></item><item><title>Re: Setting the value of a node</title><link>https://www.infopathdev.com:443/forums/thread/14736.aspx</link><pubDate>Tue, 25 Jul 2006 23:41:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14736</guid><dc:creator>Greg Collins</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14736.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14736</wfw:commentRss><description>What attribute are you trying to set?&lt;br /&gt;&lt;br /&gt;Better way to set the attribute value is:&lt;br /&gt;&lt;br /&gt;attrAllDefects = XDocument.DOM.selectSingleNode("/my:TestCaseDocument/my:TestExecutionSummary/my:AllDefects/@my:attributeToSet");&lt;br /&gt;attrAllDefects.text = allDefectIDs;&lt;br /&gt;</description></item><item><title>Setting the value of a node</title><link>https://www.infopathdev.com:443/forums/thread/12924.aspx</link><pubDate>Tue, 25 Jul 2006 22:28:31 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12924</guid><dc:creator>Nara Chilluvuri</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12924.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12924</wfw:commentRss><description>Hi,&lt;br /&gt;&lt;br /&gt;I am new to InfoPath coding and currently use JScript and Microsoft Script Editor environment to create some simple scripts for software test tracking.&lt;br /&gt;&lt;br /&gt;To date I have picked up quite a few hints on this forum that has helped me immensely.  One of the problems I am facing currently is being able to update the value of a node in an infoPath Schema by using JScript Code.&lt;br /&gt;&lt;br /&gt;I am using InfoPath forms to create Test Scripts and track their execution &amp; results. Each script has a number of test steps and as the testers execute the scritps they record Pass/Fail against each step and then record a defect id against the specific row.  At the end when the tester clicks the submit button, I have the form save a copy to a Test Execution library and publish some of the form values in the list - such as Test Script name, date executed, tester, final outcome, All Defect IDs.   &lt;br /&gt;&lt;br /&gt;It is with publishing all Defect IDs that I am facing a problem.  The Form XML Structure is something like this.&lt;br /&gt;&lt;br /&gt;&amp;lt;Test Case Name&amp;gt;&lt;br /&gt;   &amp;lt;Test Header Information&amp;gt;  &lt;br /&gt;         [Series of nodes to capture execution date, tester, final result, All Defects, etc]&lt;br /&gt;   &amp;lt;Test Script Steps&amp;gt;  1..* rows depending on the number of steps&lt;br /&gt;         &amp;lt;StepNum&amp;gt; [Auto number]&lt;br /&gt;         &amp;lt;Condition and Action&amp;gt; [Rich Text Field]&lt;br /&gt;         &amp;lt;Expected Result&amp;gt; [Rich Text Field]&lt;br /&gt;         &amp;lt;Result&amp;gt; [Combo - Pass / Fail]&lt;br /&gt;         &amp;lt;Defect ID&amp;gt; [Text string]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The code below is executed when I click on a button to "Get all defects".  This is done before sumbitting the result.  &lt;br /&gt;&lt;br /&gt;This script works fine until it has to update the value of the All Defects node with the concatenated values of the available defect ids in each failed step.  &lt;br /&gt;&lt;br /&gt;I do not know which XML method to use to update the value of the AllDefectIDs node.  &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;//This function concatenates all Defect IDs in the form&lt;br /&gt;function btnGetDefectIDs::OnClick(eventObj)&lt;br /&gt;{&lt;br /&gt;	// Write your code here&lt;br /&gt;&lt;br /&gt;    var numRows, currRow ;             // integer&lt;br /&gt;    var objRepeatingTable ;            // XML of document&lt;br /&gt;    var nodeAllDefects ;               // For AllDefects &lt;br /&gt;    var nodeTestExecutionSummary ;     // For TestExecutionSummary&lt;br /&gt;    var currDefectID, allDefectIDs ;   // strings for defect ids&lt;br /&gt;    &lt;br /&gt;    // initialise values&lt;br /&gt;    allDefectIDs = "";&lt;br /&gt;     &lt;br /&gt;    &lt;br /&gt;    objRepeatingTable = XDocument.DOM.selectNodes( "/my:TestCaseDocument/my:TestCaseSteps/my:TestCaseTable");&lt;br /&gt;    numRows = objRepeatingTable["length"];&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    // Iterate through rows and get Defect IDs&lt;br /&gt;    for (currRow = 1; currRow &amp;lt;= numRows; currRow++)&lt;br /&gt;    {&lt;br /&gt;            currDefectID = (XDocument.DOM.selectSingleNode("//my:TestCaseTable["+ currRow +"]/my:DefectID").text)&lt;br /&gt;            if (currDefectID != "")&lt;br /&gt;				{&lt;br /&gt;				if (allDefectIDs == "") &lt;br /&gt;					allDefectIDs = currDefectID ;  // for first defect only&lt;br /&gt;				else&lt;br /&gt;					allDefectIDs = allDefectIDs + "," + currDefectID ;  // for all other defects&lt;br /&gt;                }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;    //Debug - Display all defects&lt;br /&gt;    XDocument.UI.Alert("Value of Defects = " + allDefectIDs);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	//Set Value of AllDefects Node&lt;br /&gt;	nodeAllDefects = XDocument.DOM.selectSingleNode("/my:TestCaseDocument/my:TestExecutionSummary/my:AllDefects");&lt;br /&gt;	nodeAllDefects.setAttributeNode(allDefectIDs);  // &lt;font color="red"&gt;&amp;lt;-- Unable to set value of Node here&lt;/font id="red"&gt;		&lt;br /&gt;	&lt;br /&gt;    XDocument.UI.Alert("AllDefects value has been set!");&lt;br /&gt;	&lt;br /&gt;} // end of btnGetDefectIDs&lt;hr height="1" noshade id="quote"&gt;&lt;/font id="quote"&gt;&lt;/blockquote id="quote"&gt;&lt;br /&gt;&lt;br /&gt;Any advise will be greatly appreciated.&lt;br /&gt;&lt;br /&gt;Thanks&lt;br /&gt;Nara</description></item></channel></rss>