How to Calculate Balance - InfoPath Dev
in

InfoPath Dev

How to Calculate Balance

Last post 02-25-2007 01:24 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 02-23-2007 12:15 AM

    How to Calculate Balance

    Hello, I am new to InfoPath and need some help badly!

    I would like to make a form consisting of a repeating table with 4 columns, namely: Description, Debit, Credit, and Balance.

    The table header should have “opening balance” appears under “description” column, and some fixed number appears under “debit” column.

    On the “balance” column, I#%92ve used ../../my:opening balance – sum(my:debit) + sum(my:credit) formula. However, I#%92ve been getting a wrong result for “balance”. See below for example.

    I want the following:
    Description Debit Credit Balance
    Opening Balance $100 $0 $100
    Books $5 $0 $95
    Lunch $8 $0 $87
    Weekly Allowance $0 $50 $137


    Unfortunately, what I#%92m getting is:
    Description Debit Credit Balance
    Opening Balance $100 $0 $100
    Books $5 $0 $95
    Lunch $8 $0 $92
    Weekly Allowance $0 $50 $150


    Any tips/advice is certainly appreciated.
    Thanks,
    Kathie
  • 02-25-2007 01:24 PM In reply to

    Re: How to Calculate Balance

    Hi Kathie and welcome to our forum!
    The sum will calculate all entries at once. If you want a running balance, you'll have to use preceding-sibling as your opening balance and subtract the current line item. Search the forum (upper right) and site (upper left) for preceding-sibling() and current() to find references to how to use those xpath functinons. Good luck!
    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.