Exceeded number of calculations error - InfoPath Dev
in

InfoPath Dev

Exceeded number of calculations error

Last post 08-08-2007 11:26 PM by nukkumatti. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 08-08-2007 12:25 PM

    Exceeded number of calculations error

    I'm trying to delete un needed rows in a form before the data is pushed to a separate sharepoint list. I'm getting an error that states, "A calculation in the form has not been completed. The number of calculations used for a single action exceeded the maximum limit." I can't figure out what is causing the issues. Here is my code. If anyone has any ideas, I would be eternally grateful!

     EDIT: I've just noticed that error is thrown when this line is executing = oParentNode.removeChild(node) but the error occurs at irregular intervals as far as I can tell. It's not consistent.

                thisXDocument.View.DisableAutoUpdate()
                Dim oParentNode As IXMLDOMNode
                oParentNode = thisXDocument.DOM.selectSingleNode("//my:myFields")
                Dim numRows As Integer = thisXDocument.DOM.selectNodes("//my:myFields/my:MovementDetail").length
                Dim last As Integer
                Dim node As IXMLDOMNode
                Dim status As String
                Dim i As Integer

                For i = 1 To numRows
                    last = thisXDocument.DOM.selectNodes("my:myFields/my:MovementDetail").length
                    If i > last Then
                        Exit Sub
                    End If
                    node = thisXDocument.DOM.selectSingleNode("//my:myFields/my:MovementDetail[" & i & "]")
                    status = thisXDocument.DOM.selectSingleNode("//my:myFields/my:MovementDetail[" & i & "]/my:MovementType").text
                    If status = "0" Then
                        oParentNode.removeChild(node)
                        numRows = numRows - 1
                        i = i - 1
                    End If
                Next
                thisXDocument.View.EnableAutoUpdate()

    Shaun Nieves
    Sharepoint Manager
  • 08-08-2007 11:26 PM In reply to

    Re: Exceeded number of calculations error

    Yes I know why this is happeing. I try to explain. So MovementDetail is your repeating section. You check if the field MovementType value is equal to 0, if yes you delete it and now there comes your mistake. You have set "i" to 1 in your for statement but you also decrement it if you found status = 0. Imagine that you will find status = 0 in you first run so at that time i would be 1 then you decrement it so it is 0 now. then in the next run you say node = .....MovementDetail["&i&"] which would be 0 now. Point is that there is no position 0 for repeating sections. Anyway even if you could delete it now and would decrement i again to -1 i guess you for statement would't like that to much. Does this help ?
    Listen to Motörhead cos they play Rock'n Roll :)
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.