locked
Custom Numbering System RRS feed

  • Question

  • Hi

    I am aware of the fact that an incremental numbering system can be created relatively easy using the list ID in SharePoint. However we would like to create a custom numbering system which starts at 000001 and increments to 000002 onwards. Is any one aware of a function or something similar which will enable the numbering system

    Thanks
    Tony

    Wednesday, April 20, 2011 2:24 PM

Answers

  • Your next Form number is

     

    concat(substring("00000", 0, 7 - string-length(my:YouFormNumber + 1)), my:YouFormNumber  + 1)


    http://alecpojidaev.wordpress.com
    • Marked as answer by Clayton Cobb Thursday, April 21, 2011 1:48 PM
    Wednesday, April 20, 2011 2:47 PM
  • The field you assigning to and the field that enters as parameter should not be the same. For example:

    MyNewID = concat(substring("00000", 0, 7 - string-length(my:MyPreviousID + 1)), my:MyPreviousID  + 1)

    You still could use just one field but in that case this expression should be the rule on a button (Submit buton would work)

     

    P.S. Interesting. Looks like telling people that thire requests are rediculos and impossible to implement is more rewarding than providing solutions.


    http://alecpojidaev.wordpress.com


    • Marked as answer by TonySim Thursday, April 28, 2011 1:57 PM
    • Unmarked as answer by TonySim Thursday, April 28, 2011 2:28 PM
    • Marked as answer by TonySim Thursday, April 28, 2011 2:29 PM
    Thursday, April 21, 2011 1:07 PM

All replies

  • Tony, those are not actual numbers, and that's what makes it very difficult.  You will have to build in a lot of logic that checks the digit positioning and acts accordingly, because that character string does not follow any real number principles, so you can't use math functions.  Do you really have to do "numbers" like that?  It really just complicates things, and it's not even an actual number, which many non-IT people seem to not grasp when they make such requirements.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    • Marked as answer by TonySim Thursday, April 21, 2011 10:01 AM
    • Unmarked as answer by Clayton Cobb Thursday, April 21, 2011 1:48 PM
    Wednesday, April 20, 2011 2:31 PM
  • Your next Form number is

     

    concat(substring("00000", 0, 7 - string-length(my:YouFormNumber + 1)), my:YouFormNumber  + 1)


    http://alecpojidaev.wordpress.com
    • Marked as answer by Clayton Cobb Thursday, April 21, 2011 1:48 PM
    Wednesday, April 20, 2011 2:47 PM
  • Hi

    Thanks for getting back to me. Yea, I agree that the numbering system does not make sense and it would just be easier to use the list ID but management has funny requirements. I will attempt the above suggestion. Not quite sure how the above would work. I assume I just insert copy and paste the above as the default value and name the field - Form Number.

    Thanks very much
    Tony

    Thursday, April 21, 2011 6:47 AM
  • Hi

    Thanks again. Works perfectly except I am now receiving an error message which states:

     'A calculation in the form has not been completed. The number of calculations used for a single action exceeded the maximum limit.' I have tried to populate the field using a rule except this do not seem to work.

    Thanks
    Tony

    Thursday, April 21, 2011 10:00 AM
  • The field you assigning to and the field that enters as parameter should not be the same. For example:

    MyNewID = concat(substring("00000", 0, 7 - string-length(my:MyPreviousID + 1)), my:MyPreviousID  + 1)

    You still could use just one field but in that case this expression should be the rule on a button (Submit buton would work)

     

    P.S. Interesting. Looks like telling people that thire requests are rediculos and impossible to implement is more rewarding than providing solutions.


    http://alecpojidaev.wordpress.com


    • Marked as answer by TonySim Thursday, April 28, 2011 1:57 PM
    • Unmarked as answer by TonySim Thursday, April 28, 2011 2:28 PM
    • Marked as answer by TonySim Thursday, April 28, 2011 2:29 PM
    Thursday, April 21, 2011 1:07 PM
  • Alec, I did not say it was impossible to implement nor that the request was ridiculous.  Please do not go overboard.  I don't know if he marked my reply on accident, but I have been tracking the thread and made sure credit went to the right place.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Thursday, April 21, 2011 1:49 PM
  • Please get me right here. I fully respect what you are doing here. For me it's clear that your comunity contribution is much larger than mine. Sorry if you got it too personnaly.
    http://alecpojidaev.wordpress.com
    Thursday, April 21, 2011 1:57 PM
  • Please get me right here. I fully respect what you are doing here. For me it's clear that your comunity contribution is much larger than mine. Sorry if you got it too personnaly.
    http://alecpojidaev.wordpress.com

    I think was intended quite personally based on past interactions.  Even so, I understand your frustration, and it was quite warranted, but the exaggeration of the outburst was not.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Thursday, April 21, 2011 2:10 PM
  • > Please get me right here. I fully respect what you are doing here. For me it's clear that your comunity contribution is much larger than mine. Sorry if you got it too personnaly.

    Clayton was doing the job he should. You can not expect him to be in the forums and looking at every thread every minute of the day.

    In this case it was the *Original Poster* that marked Clayton's post as the answer.

    The original poster is entitled to mark whichever answer *he* considers helped him the most. In this case it was Clayton's post and not yours that he marked.

    Does it really matter? The main thing is that he got an answer to his problem not that he marked the absolutely best post as the answer.

    Just think yourself lucky you have Clayton here who is prepared to take the effort (note: the next time he looked at the thread) to adjust the markings so that your post was marked and his own unmarked. I would have just said to myself "odd, but the OP is king" and left it as it was and then locked the thread.   (and I certainly wouldn't have given you a prize in the form of the extra points for an answer for your outburst).

    Another Moderator.

     


    SP 2010 "FAQ" (mainly useful links): http://wssv4faq.mindsharp.com/default.aspx
    WSS3/MOSS FAQ (FAQ and Links) http://wssv3faq.mindsharp.com/default.aspx
    Both also have links to extensive book lists and to (free) on-line chapters
    Thursday, April 21, 2011 3:23 PM
  • Where you found me complaining about points and marking? It was just a little teasing (which I do realize is wrong to do especially here and especially to moderators.). Clayton provides very useful information 99% of time. But in remaining 1% for me it'is irresistable temptation to tease him a bit. I dont care about points. Please strip them out from me. All. I see no use to them. For me the fun is to help people and from time to time to tease them a bit (that part will be stoped from now on though because thats funny for me only)


    http://alecpojidaev.wordpress.com
    Thursday, April 21, 2011 4:07 PM
  • Hi

    Thanks for your suggestion. I have finally had the opportunity to test this and for some reason it is not working correctly. I created a data connection to receive data from the SharePoint list and then I inserted the code as a rule on the field MyPreviousID:

    MyNewID = concat(substring("00000", 0, 7 - string-length(my:MyPreviousID + 1)), my:MyPreviousID  + 1) if MyNewID is blank.

    The same number appears each time that I open the form. I believe that the error is with the data connection. It needs to pull the most recent ID.

    Thanks
    Tony

    Thursday, April 28, 2011 2:26 PM
  • You have to combine this approach with my formula.
    http://alecpojidaev.wordpress.com
    Thursday, April 28, 2011 5:15 PM
  • Hi

    Thanks for getting back to me. The approach above works perfectly except I am struggling with the formula to retrieve the next form number. I need to use a formula which converts the current ID of 5 into 000005.

    Of course max(@ID) + 1 will only give me the next form ID of 5 and if I use 'concat(substring("00000", 0, 7 - string-length(FormNumber + 1)), FormNumber  + 1)', I receive the number 000001.

    I just need to convert (@ID) to set the next ID. I am thinking that possibly the following might work; 'concat(substring("00000", 0, 7 - string-length(@ID + 1)), @ID  + 1)'. I will test and advise.

    Thanks
    Tony

     

    Friday, April 29, 2011 9:17 AM
  • HI

    Unfortunately the above does not work. Seems like I am so close but when I create a new form using 'concat(substring("00000", 0, 7 - string-length(@ID + 1)), @ID  + 1) the form receives the same number.

    Appreciate any help.

    Thanks
    Tony

    Friday, April 29, 2011 11:44 AM
  • Hi

    I got this to work with the following 'concat(substring("00000", 0, 7 - string-length(FormNumber + 1)), max(@ID) + 1)'. It seems to be working correctly however the number of zero's still remain at 5. We actually want to the form number to count down for example 10 forms would equal 000010 and 100 forms would equal 000100. Very frustrating. Not sure why the form ID is not suitable.

    Any suggestions would be very appreciated.

    Thanks
    Tony

    Friday, April 29, 2011 12:14 PM
  • I am struggling with the formula to retrieve the next form number. I need to use a formula which converts the current ID 


    I'm confused. Do you need to retrieve the next form number or current or  both?
    http://alecpojidaev.wordpress.com
    Friday, April 29, 2011 2:35 PM
  • I think the right expression is

     'concat(substring("00000", 0, 7 - string-length(max(@ID) + 1)), max(@ID) + 1)'


    http://alecpojidaev.wordpress.com
    Friday, April 29, 2011 2:39 PM