Calculation based on field if not blank - InfoPath Dev
in

InfoPath Dev

Calculation based on field if not blank

Last post 07-10-2012 01:48 PM by Jen B. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-09-2012 02:13 PM

    Calculation based on field if not blank

    Hi all,

    I wasn't exactly sure how to title this one and, therefore, wasn't sure how to search for what I'm looking to do.  The form I'm creating is also utilized for tracking progress of work.  A requirement I was given asks for a percentage calculation, however, which fields used to calculate that percentage depends on whether one of the three is blank or not.  The fields in play are: Estimated Design Hours, Adjusted Estimated Design Hours, Actual Design Hours & % Complete.

    The requirement comes out like this:

    If [Adjusted Estimated Design Hours] is blank, then % Complete = ([Actual Design Hours] / [Estimated Design Hours])*100, If [Adjusted Estimated Design Hours] is not blank, then % Complete = ([Actual Design Hours] / [Adjusted Estimated Design Hours])*100

    Essentially, % complete is calculated on actual design hours and estimated design hours unless the field for adjusted estimated design hours is not blank.  At that point, the calculation would use the adjusted estimated design hours rather than estimated design hours.

    I'm not sure how to apply rules to this without if/then statements.  I'm assuming it may require a boolean function of some sort, but I don't really know where to start.

    I'm in IP 2010 and publishing to SP 2007.

    Thanks to anyone who can help out!

  • 07-09-2012 05:09 PM In reply to

    Re: Calculation based on field if not blank

    It is possible to create conditional default values - the formulas can be a bit complex, however.

    It would be simplest to just put the same two rules on all three fields involved:

    • Adjusted Estimated Design Hours
    • Actual Design Hours
    • Estimated Design Hours

    The two rules would be:

    1. Condition: [Adjusted Estimated Design Hours] is blank - set % Completed to ([Actual Design Hours] / [Estimated Design Hours])*100
    2. Condition: [Adjusted Estimated Design Hours] is not blank - set % Completed to ([Actual Design Hours] / [Adjusted Estimated Design Hours])*100

     

    Hilary Stoupa

  • 07-10-2012 01:48 PM In reply to

    Re: Calculation based on field if not blank

    Thank you Hilary!  That worked out perfectly and was much simpler than I was expecting!

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