locked
Working with List ID RRS feed

  • Question

  • Hello,

    I would like to be able to create custom columns that are based off of the built-in ID column, with the catch being without the use of SharePoint Designer.

    For example, I create a new List item and have the custom column value be "This is row "&ID. Or another example would be working with the current ID and having the custom column be an offset value (current ID is 5, custom column displays 6).

    Is this possible? Thanks in advance.

    Wednesday, October 5, 2011 6:15 PM

Answers

  • Hi TheWon,

    What you said is right, using the calculated column will not get the ID value when new an item.

    To achieve this as expected, here I have a workaround for you,  I'm sorry to say that SharePoint Designer is needed, as SharePoint Designer is a tool integrating with SharePoint, and it is free, you may have a try,:

    Create a SharePoint Designer workflow, create a dynamic string with the ID column, then set the string to the column in list, set the workflow start options: Automatically start this workflow when an item is created.

    Action: Build Dynamic String: Store this is row:[%list:ID%] in Variable: customID
    a. Create a workflow variable customID through Variables in the left bottom
    b. in the action, set dynamic string using “this is row”, then add Lookup to find the list id
    c.  Choose Variable to workflow variable customID.

    Action: update item: update item in list

    Then go to the list, and create a new item, check whether it works.

    Thanks,
    Qiao



    Thursday, October 13, 2011 11:57 AM
    Moderator

All replies

  • Hi TheWon,

    From your description, you may consider using calculate columns to achieve this.

    Like: “this is row ”&ID, you can use formula: =”this is row ”&[ID], this is convenient and practical, you can have a try.

    For more information about calculate columns, please refer to:
    http://blog.pathtosharepoint.com/2008/08/07/calculated-columns/
    http://office.microsoft.com/en-us/windows-sharepoint-services-help/introduction-to-data-calculations-HA010121588.aspx

    Thanks,
    Qiao

    Friday, October 7, 2011 2:30 AM
    Moderator
  • Hi,

    You can do these by creating Calculated columns.

    I hope this will help you out.

     


    Thanks, Rahul Rashu
    Friday, October 7, 2011 4:30 AM
  • Hello, the issue with using Calculated Columns is this:

    You cannot reference the ID of a row for a newly inserted row. The ID does not yet exist when the calculation is performed.

    So if i use formula =”this is row ”&[ID] I end up having the cell display "this is row".

    • Edited by TheWon Friday, October 7, 2011 12:56 PM
    Friday, October 7, 2011 12:55 PM
  • What you want is a GetMax(ID, "ListName"), but that doesn't exist, unfortunately. (So, don't try it.)

    I don't know what purpose it serves when someone is entering a record to know what their ID number is potentially going to be.  (Suppose two users start a record at the same time, should they both see the same Next Record value?  (There really isn't a good solution to solving multi-user issues in SharePoint, just know that in this case, it is "first in wins".))

    So, there's no reason to show the calculated field on the Newform.aspx, as it could be bogus, anyway.

    What are you really trying to achieve?


    Steve Clark, MCTS | Twin-Soft.com
    Friday, October 7, 2011 7:30 PM
  • Hi there Steve, I've been doing a lot of research on this issue and have come to thee same conclusion as you. I have a list that contains items of work requests and to put this simply, I want to be able to name a column that functions exactly like the built-in ID column, except also append a letter in front of the number. I would assume that in a case where multiple users create an issue, whoever creates the issue first gets the lower ID number.

    I can't believe how difficult such a simple task can be with SharePoint!

    Tuesday, October 11, 2011 7:19 PM
  • Hi TheWon,

    What you said is right, using the calculated column will not get the ID value when new an item.

    To achieve this as expected, here I have a workaround for you,  I'm sorry to say that SharePoint Designer is needed, as SharePoint Designer is a tool integrating with SharePoint, and it is free, you may have a try,:

    Create a SharePoint Designer workflow, create a dynamic string with the ID column, then set the string to the column in list, set the workflow start options: Automatically start this workflow when an item is created.

    Action: Build Dynamic String: Store this is row:[%list:ID%] in Variable: customID
    a. Create a workflow variable customID through Variables in the left bottom
    b. in the action, set dynamic string using “this is row”, then add Lookup to find the list id
    c.  Choose Variable to workflow variable customID.

    Action: update item: update item in list

    Then go to the list, and create a new item, check whether it works.

    Thanks,
    Qiao



    Thursday, October 13, 2011 11:57 AM
    Moderator