Selectively Ignoring XmlEvent ChangedEvent (Insert/Delete Operation) - InfoPath 2007 - InfoPath Dev
in

InfoPath Dev

Selectively Ignoring XmlEvent ChangedEvent (Insert/Delete Operation) - InfoPath 2007

Last post 08-01-2012 04:38 PM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-31-2012 08:38 PM

    Selectively Ignoring XmlEvent ChangedEvent (Insert/Delete Operation) - InfoPath 2007

    I've developed a form based on an XML schema.  The schema contains a number of elements that are replacements for the head of a substitution group (resulting in a choice group in the form).  The hierarchy of elements in the schema results in this choice group being located within a repeating section.  One of the things I'm trying to accomplish via VBA is to maintain a count of the number of these repeating sections that are in the form (i.e., the number of instances of the underlying element). 

    I thought I was on the correct path by attaching a changed event handler to the element that corresponds to the repeating section.  I can increment or decrement a count attribute upon insertion or deletion operations of one of these repeating sections.  Unfortunately, if I change the choice section in the aforementioned choice group, it also causes my event handler for the higher level element/repeating section to run.  This also seems to qualify as an insertion operation on the repeating section, and it causes my count to become incorrect. 

    I've read about event bubbling, event object sites and sources, DataDOM OnAfterChange, and so on, but either I can't figure out how to use the proper VBA APIs to change my count only when it's appropriate (and ignoring it otherwise) or I can't do this in InfoPath 2007 or with the form I have based on the schema.  I've seen examples of creating event handlers, but the only thing I see available for my form's fields are the Changing, Changed, and Validating Events.  The arguments to these functions are of type Object and XMLEventArgs (ByVal sender As Object, ByVal e As XMLEventArgs).  I don't see how I'd filter out the "false positive" insertion events, as I don't seem to have a way to compare the site and the source.  Is there a way to accomplish what I'm trying to do?

    Thank you.

  • 08-01-2012 04:38 PM In reply to

    Re: Selectively Ignoring XmlEvent ChangedEvent (Insert/Delete Operation) - InfoPath 2007

    Hi - this shouldn't require code - just a simple count formula. Are you counting the choice groups? Or the repeating group? Maybe attach a screenshot of your schema under the Options tab in a reply and tell me what you are trying to count.

    Hilary Stoupa

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