Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / December 2004

Tip: Looking for answers? Try searching our database.

Calculations per repeating table row in VB.Net

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Parter - 30 Nov 2004 16:43 GMT
I'm "developing" an overtime claim form in InfoPath. In this form is a
Repeating Table. This table has the following fields:-

ClaimInstanceDate
TimeFrom
TimeTo
HoursWorked
HoursPaid
Reason

What I'm trying to do, is, calculate and populate the field HoursWorked with
the result of TimeTo - TimeFrom. I can do all the calculations OK in VB.Net,
I'm struggling to figure out how I know what that current 'Table' is so it
calculates and populates the correct fields.

I've tried using:-

Dim nodeClaimDate As IXMLDOMNode =
e.Site.selectSingleNode("../my:ClaimInstanceDate")
Dim nodeTimeFrom As IXMLDOMNode = e.Site.selectSingleNode("../my:TimeFrom")
Dim nodeTimeTo As IXMLDOMNode = e.Site.selectSingleNode("../my:TimeTo")
Dim nodeHoursWorked As IXMLDOMNode =
e.Site.selectSingleNode("../my:HoursWorked")

But this doesn't work. UI'm fumbling about in the dark here and it's really
starting to annoy me. Especially the lack of resources on the Internet for
doing this in managed code (not rules or JScript).

Can anybody save me, please?

Thanks.
Michelle - 30 Nov 2004 17:47 GMT
Take a look at the followinge example and see it will help you
http://www.infopathdev.com/examples/#Accessing%20and%20Updating%20Repeating%20Ta
ble%20Row%20Cells,%20v1.1


> I'm "developing" an overtime claim form in InfoPath. In this form is a
> Repeating Table. This table has the following fields:-
[quoted text clipped - 27 lines]
>
> Thanks.
Mark Parter - 30 Nov 2004 23:01 GMT
Thanks for the reply Michelle. I had a funny feeling somebody would reply
with a link from that site. Unfortunately, the example there is no use for me
and is in JScript and not managed code (VB.Net or C#).

Thanks anyway.

Anybody else?

> Take a look at the followinge example and see it will help you:
> http://www.infopathdev.com/examples/#Accessing%20and%20Updating%20Repeating%20Ta
ble%20Row%20Cells,%20v1.1

[quoted text clipped - 30 lines]
> >
> > Thanks.
Matthew Blain \(Serriform\) - 01 Dec 2004 03:35 GMT
What doesn't work with your code?

Note that the event Site and the event Source may be different...  take a
look at what they are in the debugger.

Also, the jscript code should be pretty easy to translate to C#, I imagine
the core of it is manipulating the DOM.

--Matthew Blain
http://tips.serriform.com/
http://www.developingsolutionswithinfopath.com/

> Thanks for the reply Michelle. I had a funny feeling somebody would reply
> with a link from that site. Unfortunately, the example there is no use for me
[quoted text clipped - 5 lines]
>
> > Take a look at the followinge example and see it will help you:

http://www.infopathdev.com/examples/#Accessing%20and%20Updating%20Repeating%20Ta
ble%20Row%20Cells,%20v1.1


> > > I'm "developing" an overtime claim form in InfoPath. In this form is a
> > > Repeating Table. This table has the following fields:-
[quoted text clipped - 27 lines]
> > >
> > > Thanks.
Mark Parter - 01 Dec 2004 09:27 GMT
Well, using

Dim nodeTimeFrom As IXMLDOMNode = e.Site.selectSingleNode("../my:TimeFrom")

works OK if you only want to retrieve one value, but as I'm retrieving 4 at
once, like so;

Dim nodeClaimDate As IXMLDOMNode =
e.Site.selectSingleNode("../my:ClaimInstanceDate")
Dim nodeTimeFrom As IXMLDOMNode = e.Site.selectSingleNode("../my:TimeFrom")
Dim nodeTimeTo As IXMLDOMNode = e.Site.selectSingleNode("../my:TimeTo")
Dim nodeHoursWorked As IXMLDOMNode =
e.Site.selectSingleNode("../my:HoursWorked")

Only the ClaimInstanceDate is retrieved, all the other variables end up with
no data :(

Thanks.

"Matthew Blain (Serriform)" wrote:

> What doesn't work with your code?
>
[quoted text clipped - 59 lines]
> > > >
> > > > Thanks.
Michelle - 01 Dec 2004 14:19 GMT
When you step through the debugger look at the xml for both e.Site and
e.Source as Matthew described.  The reason you may not be getting data for
the other three nodes is that they may not be contained in the e.Site XML
fragment.

Once you have the node reference to the ClaimInstanceDate (which you say
works) try traversing that node to get the other sibling values, such as:

But really, the best thing to do is look at the e.Site XML fragment you're
trying to work with in the debugger - that really will direct you much better
as to what kind of XPath you will need to write.

Michelle

> Well, using
>
[quoted text clipped - 80 lines]
> > > > >
> > > > > Thanks.
Mark Parter - 01 Dec 2004 14:35 GMT
I've managed to get it working by creating a procedure to handle all the
calculations and then passing this procedure e.Site.parentNode.

Thanks.

> I'm "developing" an overtime claim form in InfoPath. In this form is a
> Repeating Table. This table has the following fields:-
[quoted text clipped - 27 lines]
>
> Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.