Calculating multiple fields - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Calculating multiple fields

Last post 08-10-2021 08:05 AM by Hilary Stoupa. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 08-09-2021 06:27 AM

    • talync
    • Not Ranked
    • Joined on 08-05-2021
    • Posts 3

    Calculating multiple fields

    Good morning! I have a unique situation where I need to come up with a total combined cost for travel for one or more travelers. Using InfoPath 2013 and SP 2013. First, here is the end goal formula... (Total number of travelers)x(total days traveling)x(preset per diem) Now, here is the requested format... Traveler 1 + Traveler 2 + ... = TOTAL TRAVELERS (Travel End Date)-(Travel Start Date) = TOTAL TRAVEL DAYS Now are the challenges... * Customer wants TOTAL TRAVEL DAYS to auto-populate when beginning and end date are entered. They don't want the traveler to enter a number of days traveled. * Customer wanted to select individual travelers from a list created in SharePoint. I did this and made multiple lines within Sections that only appear after previous Section "Is Not EMPTY". My questions... * How can I determine the total days using the "Start" and "End" date fields * How can I add Fields that are Name, Lookup Types from a SharePoint List Thank you!
  • 08-09-2021 09:39 AM In reply to

    Re: Calculating multiple fields

    I don't understand the question about "adding fields that are Name, Lookup Types" - can you provide a bit more info on that? Date diff in InfoPath is not easy (without third-party tools like qRules or FormsViewer). There are some suggestions here you might try: https://www.titanwolf.org/Network/q/9562e297-ba21-480b-847b-a512e2e77f8e/x
    Hilary Stoupa

  • 08-09-2021 11:01 AM In reply to

    • talync
    • Not Ranked
    • Joined on 08-05-2021
    • Posts 3

    Re: Calculating multiple fields

    Thank you for your quick response. In essence, I have independent sections with individual dropdowns. Each is linked to the same internal directory. Once you select a name for the first "Traveler" the second section and drop down appears, and so on. I then have a field that should add the total number of drop downs (and therefor travelers) and add that number to another formula. I've been able to capture the proper data by creating the following rules: "If TRAVLER 5... is no blank... Set a fields value to 5", "If TRAVLER 4... is no blank... Set a fields value to 4"... ... ... The issue I'm having with this is that it stops working after the 3rd Rule runs. I have them inversed to look for Traveler 5 (the last option) and then to Traveler 4... Traveler 3... Traveler 2... Traveler 1, and I select "Don't run remaining rules if the condition of this rule is met", but it still stops on the 3rd rule and won't change my "Total Travelers" field to anything past 3.
  • 08-10-2021 03:50 AM In reply to

    • talync
    • Not Ranked
    • Joined on 08-05-2021
    • Posts 3

    Re: Calculating multiple fields

    This might be easier to understand. I have created a total of 5 "Traveler" Fields that pull info from a SharePoint directory of names. I have a rule on each field that hides the field until the previous "is not empty". I then have a "Total Number of Travelers" field that needs to capture the number of "not empty" Traveler fields. In order to do this, I have created 5 rules on the "Total Number of Travelers" field. Rule 1: If "Traveler 5" is not blank, Set fields value to 5". Rule 2: If "Traveler 4" is not blank, Set fields value to 4". And so on. I also check the "Don't run remaining rules if the condition of this rule is met" box. Everything works great until I enter a 4th Traveler. For some reason the count stops at 3.
  • 08-10-2021 08:05 AM In reply to

    I'd just use a default value for this to count all non-blank instances. See attached sample. Right click the link, save the file locally. Right click the saved file, select design. Preview, then fill in some data to see the count change.
    Hilary Stoupa

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