The number of calculations used for a single action exceeded the maximum limit - InfoPath Dev
in

InfoPath Dev

The number of calculations used for a single action exceeded the maximum limit

Last post 09-08-2008 01:22 AM by run000. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-04-2008 08:29 AM

    • run000
    • Not Ranked
    • Joined on 04-02-2008
    • Posts 8

    The number of calculations used for a single action exceeded the maximum limit

    Hi everyone,

    I'm trying to make a table dynamically using the referenced code, my problem is that when the “XDocument.DOM.documentElement.appendChild(questionClone);” line is executed a alert message is throw in the form window with this content: "A calculation in the form has not been completed. The number of calculations used for a single action exceeded the maximum limit.". It’s not a javascript error but I have been reading another post about some topic like this and I couldn’t to find out the solution.

    I could to see that if the “for (i = 0; i<nodes.childNodes.length; i++)” loop do less than 7 iterations, the message is not showed. By other way the table is always filled, with error or without it and all goes right after that.

    Can you help me?

    Thanks.

    PD. I'm using Infopath2003

    EDIT: If "row.selectSingleNode("my:XHTMLQuestion/my:QuestionDesc").appendChild(xmlDoc.documentElement.cloneNode(true));" is changed by something like : "row.selectSingleNode("my:XHTMLQuestion/my:QuestionDesc").text = "test"", the error not happend

    function msoxd_my_ProcedureID_attr::OnAfterChange(eventObj)
    {

        var nodes = domQaA.selectNodes("/dfs:myFields/dfs:dataFields/tns:GetQuestionsAndAnswersResponse/tns:GetQuestionsAndAnswersResult/NewDataSet/Procedures/Questions");

        var row, xmlDoc, div;
        xmlDoc = XDocument.CreateDOM();
        var questionClone = XDocument.DOM.documentElement.childNodes[1].cloneNode(true);
        questionClone.removeChild(questionClone.childNodes[1]);
        questionClone.removeChild(questionClone.childNodes[0]);
        for (i = 0; i<nodes.childNodes.length; i++)
        {   
            row = XDocument.DOM.documentElement.childNodes[1].childNodes[1].cloneNode(true);
            var answerRows = row.selectNodes("my:Answers/my:XHTMLAnswer")
           
            var answersNodes = nodes[i].selectNodes("Answers");
            var answerRow = answerRows[0];
            var answDiv, ansXMLDoc;
           
            for (j = 0; j<answersNodes.length; j++)
            {
               
                if(answersNodes[j].selectSingleNode("COMMENTS")!=null)
                    answerRow.selectSingleNode("my:XHTMLComment").text = answersNodes[j].selectSingleNode("COMMENTS").text;
                else
                    answerRow.selectSingleNode("my:XHTMLComment").text ="";
                answerRow.selectSingleNode("my:Score").text = answersNodes[j].selectSingleNode("ANSWERVALUE").text;
                answerRow.selectSingleNode("my:Description").text = answersNodes[j].selectSingleNode("ANSWERDESC").text;
                answerRow.attributes[0].text = answersNodes[j].selectSingleNode("ANSWERORDER").text;
                row.selectSingleNode("my:Answers").appendChild(answerRow.cloneNode(true));
            }
            row.selectSingleNode("my:Answers").removeChild(row.selectSingleNode("my:Answers").childNodes[1]);
            row.selectSingleNode("my:Answers").removeChild(row.selectSingleNode("my:Answers").childNodes[0]);
           
            row.selectSingleNode("my:XHTMLQuestion").attributes[0].text = nodes[i].selectSingleNode("QUESTIONORDER").text;
            row.selectSingleNode("my:QuestionID").text = nodes[i].selectSingleNode("QUESTIONID").text;
           
            div ="<div xmlns=\"http://www.w3.org/1999/xhtml\">" + nodes[i].selectSingleNode("QUESTIONDESC").text + "</div>";
           
            xmlDoc.loadXML(div);
           
            row.selectSingleNode("my:XHTMLQuestion/my:QuestionDesc").appendChild(xmlDoc.documentElement.cloneNode(true));

            questionClone.appendChild(row.cloneNode(true));
           
           
        }
        XDocument.DOM.childNodes[3].removeChild(XDocument.DOM.documentElement.childNodes[1]);

        XDocument.DOM.documentElement.appendChild(questionClone);

    }

  • 09-06-2008 07:45 AM In reply to

    Re: The number of calculations used for a single action exceeded the maximum limit

    Hi--

    Usually when I've had this error, it is because my code is causing a rule to run again ... and again .... and again, and the rule has a calculation in it. Could that be the case here? Does the my:QuestionDesc field have any rules set on it?

    Hilary Stoupa

  • 09-08-2008 01:22 AM In reply to

    • run000
    • Not Ranked
    • Joined on 04-02-2008
    • Posts 8

    Re: The number of calculations used for a single action exceeded the maximum limit

    Hi again, I have the solution to my problem, there isn't any rule that create a loop issue. The field "my:QuestionDesc" had checked the option "Update this value when the result of the formula is recalculated", I only have had to uncheck it.

    Thank you Hilary for your help.

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