Creating a 7 digit number based on data and use

  • Profile Image
    Asked on November 04, 2015 at 02:23 AM

    Is there a way to do auto prefix?

    I want to create an automatic job number that is 7 digits long.

    Digit 1 & 2 - would be the year (ex. 15)

    Digit 3 & 4 - would be the month (ex. 11)

    Digit 5, 6 & 7 would be sequentially automatic starting over at 1 each month.

    So if I did a request today it would 1511001 (first request of month).

    The next request would be 1511002 and so forth up to 1511999 (not that the requests go that high - they probably will seldom break 100)

    The first request in December would be 1512001...

    And the first request in January 2016 would be 1601001....

    I think you get it? Is that possible?  If the sequential part isn't, is it possible to do just the automatic prefix of the first for digits.  

    If not, I'll just have to manual start over every month.

    Thanks in advance.

  • Profile Image
    Answered on November 04, 2015 at 09:16 AM

    Unfortunately the option to have the numbers go from 0 to 999 each month is not available so this would not be possible.

    We do have Unique ID widget that can help for similar setup, but it would not restart the counter on specific date, meaning that this would need to be done manually.

    The first 4 digits would be possible, but you would need to create a workaround through the conditions to be able to pull the data in the way you need it, however if you create your form in the JotForm form builder and then just add the short JS code into the forms full source code on your website, it will work for you properly.

    This type of change would however mean that the code can not be added to the form builder, so each time you make some changes to your form, you will need to re-embed it on your website for your users to see the difference.

  • Profile Image
    Answered on November 04, 2015 at 04:04 PM

    Hi Randy, nice to see you on our forum again and again with a nice sample of how it can be done :)

    Honestly I did not know that the Unique ID would accept the field tag as parameter since our developers only made it work with Text field. Having that said I am glad to see that it works, but feel that I should mention that it might not work at some later time.

    As I mentioned in my reply, the biggest issue is the resetting part, which we can not do as it requires logic that can only be applied to the source code, meaning that it will go from 0 to 999 and even then, it should go further up - not reset its counter to 0 since that already was shown.

    The alternative is to come into the form each month and manually set index of unique ID widget to 0.

    Now the reason why the form calculation does not get activated is because it awaits the change to be reported to it, so when such things are needed to be implemented where someone might not click again, conditions should be the way to go instead of Form Calculation as it would be updated faster.

    @kellyfisher The above would work, but as mentioned only if you are willing to manually reset the counter each month, otherwise a custom development would be needed.

    Randy, thank you again :)

  • Profile Image
    Answered on November 04, 2015 at 06:04 PM

    Thank you for everyone's feedback.  I appreciate it.  I will probably stick to the manual reset every month.  It's a 10sec step, that i just need to remember to do.

  • Profile Image
    Answered on November 05, 2015 at 12:53 AM

    This thread is very helpful and inspirational :) I'll leave it as is. 

    Feel free to contact us anytime should you need further assistance.