"if" equals "fielda or fieldb" sum "fieldc" - InfoPath Dev
in

InfoPath Dev

"if" equals "fielda or fieldb" sum "fieldc"

Last post 01-08-2013 10:01 AM by kseger. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 01-07-2013 03:05 PM

    • kseger
    • Not Ranked
    • Joined on 01-07-2013
    • Posts 4

    "if" equals "fielda or fieldb" sum "fieldc"

     Help!  I am trying to create a company expense report and I can't figure out how to format a formula for the "Due Employee" cell! I need to total the "Cost" field to sum in the "Due Employee" field only if the "Pmt Method" field is PCC or CASH, does that make sense?

    Thank you in advance for all of your help!! 

  • 01-07-2013 08:29 PM In reply to

    Re: "if" equals "fielda or fieldb" sum "fieldc"

    The image you added seems to be broken, but I think a formula like this should do the trick:

        sum(repeatingRow[my:pmtMethod = "PCC" or my:pmtMethod = "CASH"]/my:cost)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-08-2013 07:50 AM In reply to

    • kseger
    • Not Ranked
    • Joined on 01-07-2013
    • Posts 4

    Re: "if" equals "fielda or fieldb" sum "fieldc"

    I hope this one goes through!

    If the example image were an actual report, I would need the "Due Employee" field to read 10

    The formula provided earlier did not work, the names of the fields are as follows;

     

    Pmt_Method (options in dropdown are BCC, PCC, CASH)

    Amount (cell under cost)

     Infopath snapshot

  • 01-08-2013 09:46 AM In reply to

    • kseger
    • Not Ranked
    • Joined on 01-07-2013
    • Posts 4

    Re: "if" equals "fielda or fieldb" sum "fieldc"

     Perhaps this image works better?

    with Desc

  • 01-08-2013 09:56 AM In reply to

    Re: "if" equals "fielda or fieldb" sum "fieldc"

    Yes, the formula in the previous post was just an example because I didn't know the actual field names.  Now that I do, I believe the formula would be:

    sum(/my:myFields/my:Itemized_Expenses/my:Receipt_Description[my:Pmt_Method = "PCC" or my:Pmt_Method = "CASH"]/my:Amount)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 01-08-2013 10:01 AM In reply to

    • kseger
    • Not Ranked
    • Joined on 01-07-2013
    • Posts 4

    Re: "if" equals "fielda or fieldb" sum "fieldc"

     YES!!! THANK YOU!!!

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.