Counting rows in repeating table is starting with #2 instead of 1 and sometimes... - InfoPath Dev
in

InfoPath Dev

Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

Last post 08-20-2013 01:37 PM by Doreen. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 08-15-2013 12:10 PM

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

    I have an integer field in my row called rowNumber. Default value(fx) is "count(preceding-sibling::*) + 1"

    when I enter the formula as noted above, row 1 and thereafter are numbered "9"

    when I change the formula to "count(../preceding-sibling::*) + 1" (and when it lets me - sometimes InfoPath balks and doesn't accept this forumula) the numbering starts with 2 and continues, skipping #1

    What is the trick to numbering rows?  I know about postion() but can't use that because my objective is to select a row by button click to indicate which row to copy to another textbox.

  • 08-18-2013 04:34 PM In reply to

    Re: Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

    Hi Doreen,

    Don't use the asterisk character. Use the name of the group. For example: "count(../preceding-sibling::my:group2) +1".

    Note: position() doesn't work in the browser.

    Patrick Halstead
    Project Manager at Qdabra
  • 08-19-2013 12:10 PM In reply to

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    Re: Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

    Thank you.  I am unable to make anything but the asterisk (*) stick in the formula - whether it be typed in fx field with "Edit XPath" clicked or not, or if typed in the default value textbox (before clicking fx).  hmmm

    • When I cilck Insert Field or Group, it inserts a dot (.) and spits out error."Node-test expected."
    • When I type in the name Example: "my:rowVeh", it spits out error "../preceding-sibling::my:rowVeh" does not point to a valid location path of a field or group."

     

    In my uploaded example I have 3 repeating tables where row numbering starts with 100, 200 or 300 depending on the section.  Note how first and last section start numbering with 2 (102, 302) instead of 1, like section 2 correctly shows (201).  Each default value is typed in the same.

    As a work-around I have changed the formula for section 1 and 3 to be "count(../preceding-sibling::*) - 1 + 1" and this causes numbering to start with #1. 

     


  • 08-19-2013 02:32 PM In reply to

    Re: Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

    Hi Doreen,

    Working out the correct syntax for preceding sibling is tricky sometimes.

    If you can attach your form, I'll take a look.

    Thanks.

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 08-19-2013 03:30 PM In reply to

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    Re: Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

    Is it ok if I email it to you?  I don't want to make the form public.
  • 08-20-2013 12:24 AM In reply to

    Re: Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

    Yes, of course, please email our support (at) Qdabra (dawt) com alias. :)

    Patrick Halstead
    Project Manager at Qdabra
  • 08-20-2013 12:19 PM In reply to

    Re: Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

    Hi Doreen,

    For rowVeh, instead of
    100 + count(../preceding-sibling::*) - 1 + 1
    I think you want
    100 + count(../preceding-sibling::my:VehicleRows) + 1

    For rowProperty, instead of
    300 + count(../preceding-sibling::*) - 1 + 1
    I think you want
    300 + count(../preceding-sibling::my:PropertyRows) + 1

    For rowEq, instead of
    200 + count(../preceding-sibling::*) + 1
    I think you want
    200 + count(../preceding-sibling::my:EquipmentRows) + 1

    I'm attaching screenshots. Hope this helps.

     


    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 08-20-2013 12:19 PM In reply to

    Re: Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

     


    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 08-20-2013 01:37 PM In reply to

    • Doreen
    • Top 50 Contributor
      Female
    • Joined on 08-11-2010
    • Federal Way, WA
    • Posts 291

    Re: Counting rows in repeating table is starting with #2 instead of 1 and sometimes...

    Thank you!  This works.  I swear I tryed that formula before - I must've navigated to the field instead of typing its XPath value manually. Navigating to insert the field changes it to a . (dot) or .. (dot dot) and throws error. It seems counter to the way a formula is supposed to insert a field.  I thank you very much. 

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