Repeating Tables and Expressions... - InfoPath Dev
in

InfoPath Dev

Repeating Tables and Expressions...

Last post 04-27-2005 08:41 AM by sainzmichael. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 04-22-2005 04:13 PM

    Repeating Tables and Expressions...

    Hey all...first time posting here. Once I saw all the good information here, thought I would try it out ;)

    I have made a order form with a repeating table for line items, very similar to the Invoicing sample. Problem is, I am binding all the textboxes and stuff to SQL. I guess that isn't the real problem here. The real problem is form related...on each line item, there is a sub total and at the bottem of the table there is a final total. But when I try to create the text box function to calculate all the sub totals for each line and display the sum, it only displays the first line item total and doesn't add the rest.

    The reason i'm posting here is that I have taken a look at the samples and they don't seem to have any default functions for the textboxes at all. That is confusing.

    Anything helps! Thanks.
  • 04-23-2005 01:14 PM In reply to

    Re: Repeating Tables and Expressions...

    Hi Sainzmichael,
    Welcome to the board! Can you reply with the calculation/xpath that you are using for the function? Also, what's the data source look like? You might want to take a look at the code in the Invoice, Timecard, or Absence Request solutions to see how totals are calculated, but those are all version 1 solutions written in script and SP1 (the latest version) actually has a lot of support for calculations built-in to the designer, so you should be able to do it using xpath.
    Cheers,

    Patrick Halstead [InfoPath MVP]
    InfoPathDev
    Patrick Halstead
    Project Manager at Qdabra
  • 04-26-2005 09:24 AM In reply to

    Re: Repeating Tables and Expressions...

    Hey Pat,
    I'm trying to create just a normal order sheet with fields for price, discount and line total in a repeated table. At the bottom of the table, I would like a grand total of all the lines together. The issue is when I try to calculate a grand total, there may be 1 line item, there may be 10 line items. How do I tell Infopath to figure out the total from line items when thats a variable? I would prefer to do this useing XPath because I took a look at the code (or at least tried too) but since its in jscript (I think...) it was all giberish to me.

    Thanks Pat!
  • 04-27-2005 06:55 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Repeating Tables and Expressions...

    Hello Sainzmichael,
    What you want to do can be done directly using the default InfoPath SP1 functionality (without any code). For the subTotal field set the Default value as number(Price) - number(Discount). This will give you the sub total value for each line item.

    Now in the grand total field set the Default value as sum(subTotal). What sum does it returns the sum of all nodes in the Node-set. Therefore your Grand total field will have the sum of all subtotal fields.

    Hope this helps!


    shiva
  • 04-27-2005 08:17 AM In reply to

    Re: Repeating Tables and Expressions...

    Shiva,

    That is exactly what I needed. Now since this form is connected to a database, my values are not posted until I hit submit. How do I do a calculation in the form with values that are not submitted to the database yet? When I follow your instructions and use SUM and bind that to a field, the field where SUM is bound is zero and i'm guessing its because it's looking at the database and finding no data yet.
  • 04-27-2005 08:41 AM In reply to

    Re: Repeating Tables and Expressions...

    Nevermind, I have figured it out. A mistake on my part.
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.