> I am using managed code for InfoPath to sum the diff. between two dates and
> displaying the "number of days" in the repeating column. The code works fine
[quoted text clipped - 11 lines]
> Thanks,
> Doug
Franck, Thanks for the response, but I must be doing something wrong.
I added the following code you mentioned and it still updates the first row
only. Yes, this gets fired during the onafterchange event. Should I use an
index number in place of the e.Site.selectSingleNode("..")?
Dim oNode As IXMLDOMNode = e.Site.selectSingleNode("..")
Dim oField1 As IXMLDOMNode =
oNode.selectSingleNode("/my:myFields/my:Request_Types/my:Request_Type/my:RequestFromDate")
Dim oField2 As IXMLDOMNode =
oNode.selectSingleNode("/my:myFields/my:Request_Types/my:Request_Type/my:RequestToDate")
oNode.selectSingleNode("/my:myFields/my:Request_Types/my:Request_Type/my:TotalDays").text = DateDiff("d", CDate(oField1.text), CDate(oField2.text)) + 1
Doug
> Hi Doug,
>
[quoted text clipped - 31 lines]
> > Thanks,
> > Doug
Franck Dauché - 16 Nov 2005 14:38 GMT
Hi Doug,
Look at my original post, for oField1, the XPath is: my:RequestFromDate, not
the full: /my:myFields/my:Request_Types/my:Request_Type/my:RequestFromDate
Same for oField2. In fact the full XPath on oNode, should not work at all.
Let me explain: you start from the event, wherever you are in the section.
By selecting "..", you go up one level in your schema to Request_Type. Form
there, you go back to RequestFromDate (the right instance).
Hope that it helps. If my post was useful, don't forget to rate it.
Regards,
Franck Dauché
> Franck, Thanks for the response, but I must be doing something wrong.
> I added the following code you mentioned and it still updates the first row
[quoted text clipped - 46 lines]
> > > Thanks,
> > > Doug
Doug H. - 17 Nov 2005 14:31 GMT
Thanks it worked, my mistake.
Doug
> Hi Doug,
>
[quoted text clipped - 62 lines]
> > > > Thanks,
> > > > Doug