Calculating Two Different "Due Dates" depending on "Last Completed" - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Calculating Two Different "Due Dates" depending on "Last Completed"

Last post 01-15-2024 07:35 AM by Hilary Stoupa. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 01-11-2024 09:40 AM

    • ScottG
    • Not Ranked
      Male
    • Joined on 01-11-2024
    • Colorado Springs
    • Posts 6

    Calculating Two Different "Due Dates" depending on "Last Completed"

    Hello All...Newbie here with a question. I have taken a new job and inherited InfoPath awesomeness. We have a training InfoPath form that has the following: Area Type of Training Last Completed Due Date We have roughly 20 locations. All but 1 location has a CPR Training of 2 years, while the 1 location has a 3 year requirement (which just changed). The current value is addDays(CPR Completed, 730) That adds 2 years to every entry. Question(s): Can we make it to where Location A & B = a 2 year due date for CPR and Location C = a 3 year due date for CPR with in the current value listed above? If not, is there a way to make the CPR Due Date editable for all locations that still automatically calculates 2 years and we manually change Location C's 3 years without causing any issues? I noticed there is a button you can select "Refresh value when formula is recalculated". But it looks like that doesn't help with my issue. Thank you for your time Scott
  • 01-11-2024 09:48 AM In reply to

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    I would not use a default value for CPR Due Date. I would instead use rules. I would put the same rules on CPR Completed and on the Location field. The rules would have conditions. If the Location = A or B, and CPR Completed is not blank, set Due Date to CPR Completed + 2 years. If the location is not equal to A and not equal to B, and CPR Completed is not blank, set Due Date to CPR Completed + 3 years. Because the user changing the CPR Completed field OR the Location field would impact the value of the Due Date, you need to have the same rules on both fields. Remove the default value for CPR Completed entirely.
    Hilary Stoupa

  • 01-11-2024 10:51 AM In reply to

    • ScottG
    • Not Ranked
      Male
    • Joined on 01-11-2024
    • Colorado Springs
    • Posts 6

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    Hey Hilary, Thank you for the add. I thought I had it but looks I might have missed something. I added two new rules attached to the Location Field. Find attached picture.
  • 01-11-2024 11:23 AM In reply to

    • ScottG
    • Not Ranked
      Male
    • Joined on 01-11-2024
    • Colorado Springs
    • Posts 6

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    I thought it was working but my SharePoint list isn't keeping the new dates when I hit save. They automatically calculate when I add a new date for TCS 3 years but when I hit save it resorts back to 2 years.
  • 01-11-2024 03:24 PM In reply to

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    Hmmm. So this is a list form? You've removed the default value from Due Date? You may need to double check your list and make sure that field doesn't have a value. You can also attach your form in a reply under the Options tab and I'll take a quick look and see if I can see what might be wrong. :)
    Hilary Stoupa

  • 01-12-2024 12:37 PM In reply to

    • ScottG
    • Not Ranked
      Male
    • Joined on 01-11-2024
    • Colorado Springs
    • Posts 6

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    I double-checked and there is no default value. I deleted those yesterday. There are no location rules.
  • 01-12-2024 01:17 PM In reply to

    • ScottG
    • Not Ranked
      Male
    • Joined on 01-11-2024
    • Colorado Springs
    • Posts 6

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    I am actually going to start from scratch. :) There are currently no default values attached to any of my fields. The goal is if Location = TCS then there Completed CPR date + 1095 days = CPR DUE DATE Location = Not TCS then there Completed CPR date + 730 days = CPR DUE DATE Do I add the action rule to the Location, CPR Completed or CPR Due field? My action is: Condition: Location is equal to TCS AND CPR Completed is not blank Rule Type: Action Run these actions: Set a field's value Field's value: CPR Due = addDays(CPR Completed, 1095) Condition: Location is not equal to TCS AND CPR Completed is not blank Rule Type: Action Run these actions: Set a field's value Field's value: CPR Due = addDays(CPR Completed, 730) Maybe?
  • 01-12-2024 02:18 PM In reply to

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    The rules get added to Location and to CPR Completed. Both of these fields could change and impact the result of the calculation. The rules then set the CPR Due Date field. I know you've checked that field no longer has a default, but maybe just verify that once more - you should be able to right click the field in the Fields task pane and check the properties of it.... I note from your original post that you'd found the "Refresh value when formula is recalculated" option, so it sounds like you know where to find the field properties. At any rate, feel free to attach the form to a reply (or email it to me, you have my email address) and I'm happy to take a look at it. It is kind of hard to guess what may be going wrong w/out seeing the form. :)
    Hilary Stoupa

  • 01-12-2024 02:49 PM In reply to

    • ScottG
    • Not Ranked
      Male
    • Joined on 01-11-2024
    • Colorado Springs
    • Posts 6

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    I can't thank you enough for your help! I sent you an email.
  • 01-15-2024 07:35 AM In reply to

    Re: Calculating Two Different "Due Dates" depending on "Last Completed"

    As we discovered in email, your rules were correct. The issue was with existing data - those due dates needed to be updated. You did that by toggling the location field for the TCS items so the due date was set correctly.
    Hilary Stoupa

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