Dynamic math calculation? - InfoPath Dev
in

InfoPath Dev

Dynamic math calculation?

Last post 12-15-2011 09:32 AM by shniggens. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 12-15-2011 08:13 AM

    Dynamic math calculation?

    I have 2 date fields that calculate the difference between days, and give the total in another field.  (thanks, Qrules)

    I have another field for time.  If the time is greater than 12:00 it subtracts half a day from the total. 

    The problem I'm having is, if I change the time to another time greater than 12:00 (noon), it will subtract again, which is not what I want.  And if I change the time to be less than 12:00, the previous calculation will still be there, obviously.

    What would be the best way to approach setting the total depending on what the time field is?  Should I use an eval function or something? 

  • 12-15-2011 09:00 AM In reply to

    Re: Dynamic math calculation?

    How about having two fields for the date difference?  One (RawDateDifference) holds the result of qRules DateDiff calculation, and the other (AdjustedDateDifference) holds the value that takes the time into account?  Then when RawDateDifference or the time change, just recalculate AdjustedDateDifference.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 12-15-2011 09:32 AM In reply to

    Re: Dynamic math calculation?

    That worked perfectly.  I used the raw date diff to store the date calc, and then just calculated the time change from that into another field.  I created a rule that firsts resets the second field to the raw date diff, and then the second rule conditionally adjusts the value if necessary.

    Simple solution again.  I was trying to hard to make it complicated.

     

    Thanks!

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