Infinite Loop To OnAfterChange

M

Michael Morse

Hello,

I am trying to create a non trusted IP solution that records the XPath for
any node the user may have changed while being worked on.

I have script on the OnAfterChange event that is supposed to record the
XPath in a seperate node which will contain all the users changes.

However when writing to this node that is storing all my changes it appears
I get into an infinite loop with an error poping up saying 'The number of
call to the OnAfterChange event for single update in the data exceeded the
maximum limit'.

Even if I put an if statement in the OnAfterChange event to exit if this
this change was cuased my my storing of the Xpath I still see the message
once but it does record my change.

Any ideas on how to get around this?
 
F

Franck Dauché

Hi Michael,

Are you using:
if(eventObj.IsUndoRedo || "Insert" != eventObj.Operation)
return;

at the beginning of your OnAfterChange?

Regards,

Franck Dauché
 
M

Michael Morse

I wasn't but I just tried it and it is still poping the errorMsg but then it
does record the XPath to the node that changed in my other node.
 
M

Michael Morse

Franck,

I am in dier need of anything you can thing off to get this solution to
work. I'm supposed to insall the prototype tomorrow.
 
M

Michael Morse

Franck,

I got it. I was setting my flag after updating the the recordingNode.. I am
now able to exit the funtion when needed.

Thanks for the help.
 
F

Franck Dauché

OK great, I am glad it is working!
Let me know if you need anything else.

Good luck for tomorrow...

Franck
 
M

Michael Morse

Franck

My InfoPath form has this data structure for me to record my changes.

XPathChanges > XPathChange > XPath

XPath Changes is a group and XPathChange is a reapting group and XPath is
the first field within that group.

It doesn't appear that when the form opens there is an XPathChange node for
my to clone and begin working with.

Does InfoPath not put one in until the user actually needs it? How must I
create a node if there isn't one there for me to clone?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top