in

InfoPath Dev

Auto number rows

Last post 04-04-2008 02:05 AM by Albert. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 03-16-2006 04:21 PM

    • Carlos
    • Top 150 Contributor
    • Joined on 01-25-2006
    • Australia
    • Posts 31

    Auto number rows

    I need to auto number repeating section row field, but unlike use the preceding-sibling option, I dont the numbers to adjust if a row is deleted. Example, if I create 7 repeated rows, the row number would be 1,2,3,4,5,6,7. But if I delete say row 3, the numbers should still read 1,2,4,5,6,7 rather than adjusting for the deleted 3.

    Any ideas how to do this without code?
  • 03-16-2006 04:52 PM In reply to

    Re: Auto number rows

    G'day Carlos,

    Right below the default value formula box there is a checkbox that says "Update this value when the result of the formula is recalculated". If you uncheck this, it should work how you want it.
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 03-16-2006 05:03 PM In reply to

    • Carlos
    • Top 150 Contributor
    • Joined on 01-25-2006
    • Australia
    • Posts 31

    Re: Auto number rows

    Hi Matt,

    This does work great for insetions, but for a little issue where, once you delete a row, and then proceed to add an new row, the number generated is the same as the last number, eg: 1,2,4,5 and then add new repeating rows, which would then show 1,2,4,5,5,6,7 etc. So it seems to duplicate the last number, and in some cases, start the count from a previous number like 1,2,4,5,4,5,6,7. Any way around this?

    Cheers,
  • 03-16-2006 08:05 PM In reply to

    Re: Auto number rows

    Hm, yes, I do see my mistake now. I can't think of an easy way to do this with simple formulas / rules, but I know you could do it with a helper node. Make an extra node somewhere (probably in a secondary data source) and update it each time you insert a new row with the next number that should be used. The set the default value of the autonumber field in the table to this node, and turn off auto-update.

    I think this should work, even though it is a few more steps. Hope you get it working!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 06-01-2007 06:27 AM In reply to

    • nikopol
    • Top 500 Contributor
    • Joined on 03-20-2007
    • France
    • Posts 11

    Re: Auto number rows

    Hello, I have a solution for you (which works for me): you have to put the following rule in the settings of your text box (in the default value):

    "count(../preceding-sibling::my:table_row) + 1"  (where table_row is the name of the row of your table :)

     

    Don't forget to tick the check box "Update this value..."

     Hope this helps.

     

    Nicolas.
     

     

     

  • 03-16-2008 05:33 PM In reply to

    • PJagger
    • Top 200 Contributor
      Male
    • Joined on 11-19-2007
    • Australia
    • Posts 29

    Re: Auto number rows

    I am trying to use this code in the formula of a field in my repeating table, however, I am having trouble with the correct syntax to identify my:table_row. My form is in JScript and has the following structure..

    my:myfields/my:itemisations/my:itemrepeatingsection/my:accountsdetails

    ...where "accountsdetails" is a (non-repeating) sub-group in the repeating section holding a field called "rowcount" in which I am trying to establish the incrementing number.

    Filed under: , ,
  • 03-16-2008 09:05 PM In reply to

    • PJagger
    • Top 200 Contributor
      Male
    • Joined on 11-19-2007
    • Australia
    • Posts 29

    Re: Auto number rows

    Further to the above, I cannot even get this to work on a brand new template with a single repeating table with 3 default fields (field1, field2, field3).  If I use the formula listed in this post, I simply get a '1' in field3 (being the increment field) for every inserted row.

    Please Help

  • 04-04-2008 02:05 AM In reply to

    • Albert
    • Top 150 Contributor
    • Joined on 04-03-2008
    • The Netherlands
    • Posts 32

    Re: Auto number rows

    Hi,
     
    To reproduce follow the steps below:
    1. Create new form
    2. Create new -repeating- group named repeating_group in  the root
    3. Create new field in repeating_group called autonummer
    4. Create some more fields in repeating_group as you like
    5. Drag the repeating group with rightmouse from datasource on the form and choose repeating section with controls
    6. Doubleclick autonummer field and set its value to count(../preceding-sibling::my:repeating_group) + 1
    7. Make sure update value is checked (default)
    8. Preview form and add some rows
    Albert
Page 1 of 1 (8 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.