Big problem calculating - InfoPath Dev
in

InfoPath Dev

Big problem calculating

Last post 07-27-2013 09:43 PM by Patrick Halstead. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-25-2013 08:13 AM

    Big problem calculating

    After updateing our Infotpath with MS Updates, this function does not work anymore (it calculates some fileds).

    Anyone any idea?

    Function CalcTotal() On Error Resume Next
       Dim FromTime
       Dim TillTime
       Dim Pause
       Set configNode = XDocument.DOM.selectSingleNode("/my:IZETimeSheet/my:FromTime")
       FromTime = Date() & " " & configNode.text
       Set configNode = XDocument.DOM.selectSingleNode("/my:IZETimeSheet/my:TillTime")
       TillTime = Date() & " " & configNode.text
       Set configNode = XDocument.DOM.selectSingleNode("/my:IZETimeSheet/my:PauseDuration")
       Pause = configNode.text * 60
       Set configNode = XDocument.DOM.selectSingleNode("/my:IZETimeSheet/my:Total")
       configNode.text = cdbl(FormatNumber(round((Datediff("n",FromTime,TillTime)-Pause)/60,2),3))
       configNode.text = Replace(configNode.text,",",".")
    End Function

  • 07-27-2013 09:43 PM In reply to

    Re: Big problem calculating

    Hi Dr Goebel and welcome,

    It sure is frustrating that an update would cause a break. I'm not sure why this broke but I have a simple solution.

    Replace the code with declarative logic in the form. You can do your calculation just fine without code.

    Just add a rule and an action to set the value with the calculation. All Xpath and it will work fine. You will need to learn about how to create a declarative xpath function in InfoPath, but not a big deal. In addition to actually working, the other benefit will be you don't need code (so less maintenance hassle).

    :) 

    Patrick Halstead
    Project Manager at Qdabra
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.