I need to populate a field with a predefined title such as "CHG0001." The "1" being the ID for the item we are about to enter. So I believe I need to pull the ID from the newest item and add one to populate this field.
Anyone have this before?
I need to populate a field with a predefined title such as "CHG0001." The "1" being the ID for the item we are about to enter. So I believe I need to pull the ID from the newest item and add one to populate this field.
Anyone have this before?
This is really good. However, these numbers aren't consecutive.
How would I guarantee consecutive number?
Maybe, subtract 1 from the outcome?
thoughts?
Hmm, what is the use case that requires this to be populated on the form? Why not just not have this field appear on the "New" form and then you can set the field with workflow, and show the field in "Edit" and "Display" modes?
I have thought about that. It would be easy just to build this field on create, but it's a requirement to have this show as a user is submitting the request.
Hi,
Create a field name "ToQuery" with default value "X".
Use the following formula in a calculated value:
Max(Lookup("ListName","ToQuery","X","ID",TRUE)) so you will get the max ID in the list.
TRUE is used to return multiple values in an array.
Am not aware of the strongly typed values.
what you mean with they are not consecutive?
solution is based on by sharepoint generated item ID, which is definitely consecutive.
if this is the only reason, then I'd rather try to convince users/project owner that this is not the way how sharepoint works.
creating customized IDs just after an item is submitted is much simpler and straightforward solution.
the method you suggested causes the actual numbers to skip every other one. Because as you stated SharePoint generates the ID so with this method you create one to get the ID to the page, then you delete it. Therefore, you have a number on your page now (i.e.CHG1 ), but the one you are about to create is the next ID number (i.e. ID = 2). So when you create another request the new number generated for the page is the last ID + 1 making the new request number (i.e. CHG3). 1 and 3 are not consecutive.
I will probably end up doing this, at least for now, but this is not a solution. Because it breaks the requirement.
the point is, if you are going to generate IDs at the timepoint when an user starts filling in a form you can never avoid either gaps or duplicates.
therefore I suggested in the other post to wait until an item is submitted and just then assign it a custom ID based on item ID.
do not even rely on looking up for max existing ID, it's not reliable either.
Good idea ! . Thanks.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.