Autonumbering within a repeating table - InfoPath Dev
in

InfoPath Dev

Autonumbering within a repeating table

Last post 02-22-2012 10:19 AM by karson6. 11 replies.
Page 1 of 1 (12 items)
Sort Posts: Previous Next
  • 02-16-2012 08:36 AM

    Autonumbering within a repeating table

    I have a number field within a repeating table.  How can I have this automatically increment when rows are added?

     I tried putting the following within the default value property of my number field but it didnt' work.  InfoPath gives me an error saying the value is not valid for the field's data type - which is set to Whole Number (integer):

    count(preceding-sibling::landEstimate) + 1 

    Thanks!

  • 02-16-2012 08:57 AM In reply to

    Re: Autonumbering within a repeating table

    Is landEstimate the field? Or the repeating group?

    I'd try something like:

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

    However, if your formula syntax is correct and it is just a data type issue (which would sort of surprise me - I'd expect a count + 1 to return a number) you can always add the number function:

    number(count(preceding-sibling::landEstimate) + 1)

    Hilary Stoupa

  • 02-16-2012 10:18 AM In reply to

    Re: Autonumbering within a repeating table

    The landEstimate is the name of the repeating group.  I both of the options your provided above and both give me the same InfoPath error:

    The error says the The value is not valid for this field's data type.  Enter a different value (example:"1234") or leave the box blank.

     Am I putting the function in the right place?  I added as the Default Value and my data type is Whole Number.

    I'm using InfoPath 2010 if that matters. 

     

     

  • 02-16-2012 10:23 AM In reply to

    Re: Autonumbering within a repeating table

    Are you clicking on the "fx" button and using the formula editor? Or are you just typing directly in the default value text field?

    Hilary Stoupa

  • 02-16-2012 11:44 AM In reply to

    Re: Autonumbering within a repeating table

    I've tried it both ways.  I've clicked on the fx button and tried entering by selecting the count function.  I've tried pasting my formula after clicking the fx button and I've typed it straight into the default value field without clicking the fx button.  Same error each way.

  • 02-16-2012 12:12 PM In reply to

    Re: Autonumbering within a repeating table

    Feel free to attach your template under the options tab and I can take a look. The formula needs to go in the formula editor - using the fx button.

    Hilary Stoupa

  • 02-22-2012 04:16 AM In reply to

    Sorry it took me so long to get back to this problem.  I attached the form.  I am trying to get the autonumbering within the landNumber field within the Land Estimate repeating table.

    Thanks for your help! 

     

  • 02-22-2012 08:52 AM In reply to

    See attached. You'll need to save the form locally, right click the template and select design to open in design mode - from there you can re-save / preview / etc.

    Hilary Stoupa

  • 02-22-2012 09:45 AM In reply to

    Re: Autonumbering within a repeating table

    Thanks Hilary - I was able to open it and see it is working.  What is confusing though, is what you were able to place in the default value for landNumber via the fx button is exactly the same as I tried enter via the fx button.  I checked my original post to see what was different and the syntax is identical.  What could I have been doing wrong to get the data type error?

    Thanks again! 

     

  • 02-22-2012 09:52 AM In reply to

    Re: Autonumbering within a repeating table

    Honestly, without seeing what you were doing, I'm just not sure....

    Hilary Stoupa

  • 02-22-2012 09:57 AM In reply to

    Re: Autonumbering within a repeating table

    Oh, and select Edit XPath in the formula editor - did you have the initial "../" before preceding-sibling?

    Hilary Stoupa

  • 02-22-2012 10:19 AM In reply to

    Re: Autonumbering within a repeating table

    Ok - the Edit XPath was the difference.  I tried to duplicate this function in the Improvements repeating table below and was getting the exact same error.  I had added the "../" manually and InfoPath didn't like it.  When I click on the Edit XPath button, the ../ is added automatically and I was able to Apply the change to the text box without error.

    Thanks! 

     

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