Count or increment - InfoPath Dev
in

InfoPath Dev

Count or increment

Last post 02-13-2012 06:29 PM by jaxkookie. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-03-2011 08:09 AM

    Count or increment

    I have recently upgraded to IP07. In the process of this new form development I have a few requirements i am trying to figure out. I have figure out how to add a submit button. Now I want to increment a hidden field each time the submit button is clicked. no matter what i have tried I can't figure the syntax. I have found many posts to set a field, mostly dates, but nothing to add or increment a field value.

     

    Also I am tryinmg to figure out how to convert a number field to a 4 digit field. I need to convert 2 to 0002. I have tried data validation and rules but nothing worked. I figure this would need to be in the code. Because I am in the early stage of development I am not fixed on any one language.

     

    any help or guidence is greatly appreciated.

    Kind regards,
    Larry
    Filed under: , ,
  • 05-03-2011 08:22 AM In reply to

    To increment a field value, just use a rule to set the field's value to

    Field + 1.

    This formula should work for appending leading zeros:

    concat(substring("0000", string-length(Field) + 1), Field)

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-03-2011 09:08 AM In reply to

    Thanks Jimmy, the second solution worked perfectly I had to add an additional field because I was grabbing the SP Id number and adding 1, but once I did this in another field I could apply your solution and it returned witht the leading zeros.

      I am struggling a bit with the first solution. I cannot get it to increment or even populate a value. Is there something I am missing in the rule maybe you didn't post?

    Kind regards,
    Larry
  • 02-13-2012 06:54 AM In reply to

    Jimmy,

     Did this ever get resolved?  I ask because I had a similar issue with incrementing a field.  I grabbed numbers from the ID column of a SP library and added 1.  So I set a rule to query the library then i used the formula max(@ID)+1.  the ID is the library I was querying, thus giving me the most up to date information on the form.  Hope this helps.

     

  • 02-13-2012 06:29 PM In reply to

    It has been resolved. I read a post from Jimmy that gave me an idea. I added a field outside of my repeating table. You can increment this field 1 of 2 ways. Set a rule on the repeating table. Add one to that field onchange. This will add one everytime a row is added. A second rule you can be use to set the value of your increment field. You can also do this with code behind. Because i was already using code i went that route after trying the rules
    Kind regards,
    Larry
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.