<?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: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14409.aspx</link><pubDate>Tue, 25 Jul 2006 21:08:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14409</guid><dc:creator>kikkoman</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14409.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14409</wfw:commentRss><description>hello everyone!&lt;br /&gt;&lt;br /&gt;i'm having trouble trying to get the value of a repeating row. what i want to do is in the repeating row, i have a check box field and when users check that field, i want to get the value of a field in the same row and copy it to another field in the same row.  i'm calling my code in the On_After_Change of the check box field.  Here's a simple schema:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;my:a_group&lt;br /&gt;  my:a_group2 (repeating)&lt;br /&gt;    my:Number&lt;br /&gt;    my:override&lt;br /&gt;    my:aDatefield&lt;br /&gt;    my:anotherDatefield&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;So in that function. i tried&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public void override_OnAfterChange(DataDOMEvent e)&lt;br /&gt;{&lt;br /&gt;  IXMLDOMNode the_node = e.Site.selectSingleNode("my:aDatefield");&lt;br /&gt;  string node_value = the_node.text;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;			&lt;br /&gt;This does not work, it always says it doesn't exist.  i searched the forums and there were plenty of discussions on this topic and i tried e.Source, but that didn't work either. i saw on one post that: "e.Site will always have a reference to the node, where as e.Source will have reference to the node or attribute whose value has changed.:&lt;br /&gt;&lt;br /&gt;I tried changing to the whole Xpath but that doesn't work either.  I know that you can just go straight to the node of the current row in the repeating section by just specifying the field name ("my:aDatefield") instead of the whole xpath, but its not working.  I also tried ("//my:aDatefield") and other numerous combinations but I'm doing something wrong in my xpath.&lt;br /&gt;&lt;br /&gt;I can get the value by using this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;string strRowNumber = e.Site.nextSibling.nextSibling.nextSibling.nextSibling.text;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;But I know you should never do this because if you add a field to the repeating group in the schema, this would be referencing the wrong field.&lt;br /&gt;&lt;br /&gt;Can someone please help me on this?  I know this subject has been brought up alot, but i just can't seem to figure it out.  I'm assuming its the xpath!  Anyhow, any comments are greatly appreciated!&lt;br /&gt;thanks in advance,&lt;br /&gt;================&lt;br /&gt;DOH! I can just use rules behind my field to set the value of one field to another in the repeating group. I can't believe I did not think of this. I've been doing this all along for other stuff, but I don't know why I totally forgot. Anyhow, if anyone does know the xpath just in case i need it for some odd reason, that would be great! DOH!!!! on me!</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14408.aspx</link><pubDate>Mon, 27 Mar 2006 13:50:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14408</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14408.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14408</wfw:commentRss><description>seems to work! Thanks! &lt;br /&gt;&lt;br /&gt;So...either I &lt;br /&gt;1)sacrifice a data field of a repeating group OR &lt;br /&gt;2)create an external structure to hold the value....hmmm slow&lt;br /&gt;&lt;br /&gt;neither is an elegant solution..I'll probably sacrifice a data field to get as much speed as possible.&lt;br /&gt;&lt;br /&gt;I still say that MS needs to provide a property of eventObj that holds the row - then we wont have to sacrifice a data field, and add rules &amp; code to figure it out.&lt;br /&gt;&lt;br /&gt;Thanks for your help though!</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14407.aspx</link><pubDate>Mon, 27 Mar 2006 04:13:05 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14407</guid><dc:creator>Abhishek</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14407.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14407</wfw:commentRss><description>Hi Brandt.&lt;br /&gt;I got the mistake u have done.&lt;br /&gt;&lt;br /&gt;When u use e.Source or eventObj.Source, u r not supposed to use the full XPath of ur field.&lt;br /&gt;&lt;br /&gt;U should just give the &lt;b&gt;field name &lt;/b&gt;since eventObj.Source already points to the repeating group.&lt;br /&gt;&lt;br /&gt;So the right thing to use is&lt;br /&gt;eventObj.Source.selectSingleNode("&amp;lt;Field name&amp;gt;").text&lt;br /&gt;&lt;br /&gt;Example of the one I use in C#&lt;br /&gt;string strRowNumber=e.Source.selectSingleNode("my:RowNumber").nodeTypedValue.ToString();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Let me know if u got it right&lt;br /&gt;Regards,&lt;br /&gt;Abhishek&lt;br /&gt;&lt;br /&gt;</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14406.aspx</link><pubDate>Fri, 24 Mar 2006 13:22:35 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14406</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14406.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14406</wfw:commentRss><description>Still trying your way...I always get the value of the first row using:&lt;br /&gt;var x = eventObj.Source.selectSingleNode("/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail/@placeholderfield").text;&lt;br /&gt;XDocument.UI.Alert("x:" + x);</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14405.aspx</link><pubDate>Fri, 24 Mar 2006 12:56:53 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14405</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14405.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14405</wfw:commentRss><description>buttons have no value...here's what I wound up doing:&lt;br /&gt;1) create a placeholder field in my detail table (make it hidden) and give it a default value using: &lt;br /&gt;count(../preceding-sibling::d:tblRADetail/@Piece) + 1 (you can pick any field from the row)&lt;br /&gt;2)create a 2ndairy ds called Support with one element RowPosition...this is an external resource file...actually I used Greg Collins' example...Support.xml&lt;br /&gt;3)create a rule on the button(s) to set Suport/RowPosition to the default value of my placeholder field&lt;br /&gt;4)in the button's OnAfterChange event go get the value of Support/RowPosition...since the rule runs b4 the code this gives me the row position just by pressing the button...and I can use it as an array index to work with the row's fields.&lt;br /&gt;&lt;br /&gt;No wonder this stuff is slow as mud.&lt;br /&gt;&lt;br /&gt;We need a property of eventObj that returns the row index of the repeating group.&lt;br /&gt;</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14404.aspx</link><pubDate>Fri, 24 Mar 2006 10:51:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14404</guid><dc:creator>Abhishek</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14404.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14404</wfw:commentRss><description>Hi Brandt,&lt;br /&gt;            I am unable to understand what u want?&lt;br /&gt;Can u be more clear?&lt;br /&gt;Place the code I gave u in the event handler(OnClick) of the button.&lt;br /&gt;Using e.Source... allows u to access the value of any fields in that row from where u clicked the button.&lt;br /&gt;Example:&lt;br /&gt;If u click the button in the 5th row,then using e.source will get u the data contained in the fields of the 5th row.&lt;br /&gt;&lt;br /&gt;And u need to use eventObj instead of e in JScript.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Abhishek</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14403.aspx</link><pubDate>Thu, 23 Mar 2006 16:08:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14403</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14403.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14403</wfw:commentRss><description>or even a 2ndairy data source that I can refer back to in code...maybe a rule setting a field in the 2ndairy ds...but how to make sure I get the value from the current row...ie the row from which the btn was clicked?</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14402.aspx</link><pubDate>Thu, 23 Mar 2006 15:58:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14402</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14402.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14402</wfw:commentRss><description>tnx...that seems to id the row properly...but how can I determine that vale from just a button click from that row....if I can't get to it from eventObj...can I use a rule to set a global variable in JS?</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14401.aspx</link><pubDate>Thu, 23 Mar 2006 13:43:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14401</guid><dc:creator>Abhishek</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14401.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14401</wfw:commentRss><description>Hi brandt,&lt;br /&gt;        First go to the following link to Assign an Autogenerated Row Number to a Repeating Field say RowNumber.&lt;br /&lt;a target="_blank" href=http://www.infopathdev.com/howto/tutorials/default.aspx?i=d663d7df90e94e65abb02632966e8127&gt;http://www.infopathdev.com/howto/tutorials/default.aspx?i=d663d7df90e94e65abb02632966e8127&lt;/a&gt;&lt;br /&gt;Now all the rows will have the RowNumber field populated with row numbers.&lt;br /&gt;&lt;br /&gt;Now on the click of a button present in the row...&lt;br /&gt;use the following code to access the row number.&lt;br /&gt;example in C#...&lt;br /&gt;string strRowNumber=e.Source.selectSingleNode("my:RowNumberEditable").nodeTypedValue.ToString();&lt;br /&gt;&lt;br /&gt;Sorry for the example in C#.I think the one in JScript should be similar.I think u need to use "eventObj" instead of "e".&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Abhishek</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14400.aspx</link><pubDate>Thu, 23 Mar 2006 12:41:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14400</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14400.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14400</wfw:commentRss><description>The proper syntax for what I want to use is:&lt;br /&gt;var sPiece = getNodeValue("/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail[" + iRow + "]/@Piece");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I can get iRow by looping thru the node looking for a match on @Piece - as long as sPiece is unique to the node list - kind of kludgey...and slow...I think what is needed is a property of objEvent that would provide the row of the repeating section that the control fired from...&lt;br /&gt;&lt;br /&gt;function getRowIndex(sPiece)&lt;br /&gt;{&lt;br /&gt;	var dom = XDocument.DOM;&lt;br /&gt;	var lines = dom.selectNodes("/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail");&lt;br /&gt;	&lt;br /&gt;	// loop through each line item searching for the matching Piece...&lt;br /&gt;	iRow = 1;&lt;br /&gt;    while (iRow &amp;lt;= lines.length) {&lt;br /&gt;		var xPath = "/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail[" + iRow + "]/@Piece"&lt;br /&gt;		var sVariable= getNodeValue(xPath);&lt;br /&gt;		if (sVariable == sPiece) {&lt;br /&gt;			break&lt;br /&gt;			}&lt;br /&gt;		iRow++;&lt;br /&gt;		}&lt;br /&gt;	return(iRow);		&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*------------------------------------------------------------------------------&lt;br /&gt;	getNodeValue()&lt;br /&gt;------------------------------------------------------------------------------*/&lt;br /&gt;function getNodeValue(xpath, defaultValue)&lt;br /&gt;{&lt;br /&gt;	var xmlNode = getNode(xpath);&lt;br /&gt;&lt;br /&gt;	if (isInvalidOrEmpty(xmlNode))&lt;br /&gt;		return (arguments.length &amp;gt; 1) ? defaultValue : "";&lt;br /&gt;	else&lt;br /&gt;		return xmlNode.text;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*------------------------------------------------------------------------------&lt;br /&gt;	getNode()&lt;br /&gt;------------------------------------------------------------------------------*/&lt;br /&gt;function getNode(xpath)&lt;br /&gt;{&lt;br /&gt;	// Both XML node and absolute XPath are allowed.&lt;br /&gt;	if (typeof(xpath) == "string")&lt;br /&gt;		return XDocument.DOM.selectSingleNode(xpath);&lt;br /&gt;	else&lt;br /&gt;		return xpath;&lt;br /&gt;}&lt;br /&gt;</description></item><item><title>Re: Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/14399.aspx</link><pubDate>Tue, 21 Mar 2006 20:22:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14399</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14399.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14399</wfw:commentRss><description>Sorry-I left out this:&lt;br /&gt;&lt;br /&gt;I am trying to get the row position after clicking a button on the repeating table row.....so event.Obj.Site doesnt work</description></item><item><title>Row Position...again</title><link>https://www.infopathdev.com:443/forums/thread/12822.aspx</link><pubDate>Tue, 21 Mar 2006 20:08:07 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12822</guid><dc:creator>brandt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12822.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12822</wfw:commentRss><description>I need the current row position for a repeating table in JScript...I've looked at the code &amp; rules from Greg Collins' posts &amp; samples,but can't figure it out for use w/o a ddlb...I think I want something similar to the preceding-sibling stuff?? But how does that translate into JS? Using an OnAfterChange event with this snippet:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var sPiece = getNodeValue("/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail[2]/@Piece");&lt;br /&gt;&lt;br /&gt;[2] always selects the 2nd row- but I need a variable there&lt;br /&gt;&lt;br /&gt;var iRow = ?????????&lt;br /&gt;&lt;br /&gt;   so I can use&lt;br /&gt;var sPiece = getNodeValue("/dfs:myFields/dfs:dataFields/d:tblRAHeader/d:tblRADetail[iRow]/@Piece");&lt;br /&gt;</description></item></channel></rss>