Output position() in Error ScreenTip - InfoPath Dev
in

InfoPath Dev

Output position() in Error ScreenTip

Last post 12-20-2012 08:11 PM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 12-20-2012 10:50 AM

    • DevDen
    • Not Ranked
    • Joined on 12-14-2012
    • Posts 2

    Output position() in Error ScreenTip

    I am using the position() function to display the position in which each row in a repeating table is located in the XML. This is being shown to the user using an Expression Box next to each row.

    How can I display that position in the screentip of an error (from Data Validation) and/or in the error generated by using the e.ReportError() method.

    Thank you.

  • 12-20-2012 08:11 PM In reply to

    Re: Output position() in Error ScreenTip

    I don't believe that validation rules allow for dynamic messages, so that wouldn't be an option.

    In code, probably the easiest way to get a field's position is something like.

    XPathNodeIterator previousRows = e.Site.Select("../preceding-sibling::my:repeatingGroup", NamespaceManager);

    int position = previousRows.Count + 1;

    You may need to add or remove ../s to the path depending on the relative path from e.Site to the repeating group.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.