Change in calculation based upon option button - InfoPath Dev
in

InfoPath Dev

Change in calculation based upon option button

Last post 07-05-2006 06:45 AM by kriz10gal. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-30-2006 11:47 AM

    Change in calculation based upon option button

    A choice on an expense report I am working on asks if the expense was charged to a credit card. If the expense was charged to the credit card, it isn't calculated into the weekly expense report, but simply written there for record. Currently, I have an "Expenses charged directly to Option Care Corporate?" choice in a repeating table with the other fields. It is a Yes or No (1 or 2) option. Is there a way for me to tell my "Total Expense" calculated field to NOT add the number if the option button "Yes" is chosen (but if otherwise, continue with the calculation)?
  • 06-30-2006 05:08 PM In reply to

    Re: Change in calculation based upon option button

    Yes, you should be able to do this with a simple XSL statement. Assuming your schema looks like this:

    Group
    --LineItem (repeating)
    ----CreditCard
    ----Amount

    Your calculated field will be this:
    sum( LineItem/Amount[../CreditCard = "no"] )

    To do this in the Designer,
    1. double-click the field that you wish to calculate the total and click the Function button.
    2. Click the Insert Function button, select sum, and then click OK
    3. Double-click the link to insert a field, select Amount from the data source tree, and then click Filter Data
    4. In the filter data, select CreditCard from the first drop-down, "is equal to", from the second drop-down, and then "no" from the third drop-down.
    5. Click OK until you are back to the canvas, and then click Preview to try it out.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 07-05-2006 06:45 AM In reply to

    Re: Change in calculation based upon option button

    quote:
    Originally posted by Matt Faus

    Yes, you should be able to do this with a simple XSL statement. Assuming your schema looks like this:

    Group
    --LineItem (repeating)
    ----CreditCard
    ----Amount

    Your calculated field will be this:
    sum( LineItem/Amount[../CreditCard = "no"] )

    To do this in the Designer,
    1. double-click the field that you wish to calculate the total and click the Function button.
    2. Click the Insert Function button, select sum, and then click OK
    3. Double-click the link to insert a field, select Amount from the data source tree, and then click Filter Data
    4. In the filter data, select CreditCard from the first drop-down, "is equal to", from the second drop-down, and then "no" from the third drop-down.
    5. Click OK until you are back to the canvas, and then click Preview to try it out.



    Nevermind! I originally had a problem, but I fixed it. My True/False values are 1 and 2, so the "no" didn't work for me.

    Thanks so much!

    P.S. How'd you get so good with InfoPath?
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.