Preceding-Sibling formula on Default Value - InfoPath Dev
in

InfoPath Dev

Preceding-Sibling formula on Default Value

Last post 03-25-2015 07:31 AM by ShaneHarvy. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-25-2015 06:41 AM

    Preceding-Sibling formula on Default Value

    Good day! I am trying to set up a count(preceding-sibling) formula as a default value on a repeating table, using an integer field for a line ID. I have set up the schema correctly and went into the properties for the ID field within the repeating group and in the default value field entered the formula "count(preceding-sibling::Change) + 1" (Change being the repeating group) into the formula section and continue to get the Node-Test expected error. I have tried using advanced XPath entry, setting the field by using the "Choose a field" button, manually entering the formula and other things, but always seem to get the same error. Could you please point me in the direction of where and how to enter this formula... it seems easy enough and I see you guys use it ALL THE TIME, but I cannot figure out the actual place and method to get it to work... Thank you!
  • 03-25-2015 07:15 AM In reply to

    Re: Preceding-Sibling formula on Default Value

    Oh, it looks like you might be missing a namespace prefix. If you go to the data source task pane, right click the Change node and select copy XPath, what's the XPath?

    I'd think (if this is a default value on a field inside the Change group) you'd likely need:

    count(../preceding-sibling::my:Change) + 1

    to move up from the ID node and count the preceding Change groups.

    Hilary Stoupa

  • 03-25-2015 07:31 AM In reply to

    Re: Preceding-Sibling formula on Default Value

    Awesome. That fixed it. I was not using the "../" at the beginning or the "my:" after the preceding-sibling. Thank you so much!
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.