This discussion is archived
2 Replies Latest reply: Mar 26, 2012 12:49 PM by ppm user RSS

Autonumbering in a category

916144 Newbie
Currently Being Moderated
Hi!

I would like to create a category that ges an autonumber like a unique identifier.

Reason is that I have a dynamic list of type change request and I would like one of the categories "Change Request Number" in the linked scorecard to be auto generated.

Do I have to write an advanced function to get that unique number or is there a standard way how to approach this? Do you have something similiar and how have you solved it?

Best regards,
Monica
  • 1. Re: Autonumbering in a category
    gCubed Journeyer
    Currently Being Moderated
    You can get an item's id with the following function. Create an Integer category and set the Value data source to Calculated with the following Advance Function.

    //
    // Return the Item ID for items and subitems
    //
    return getCell("Manager").ItemID;

    The will return the unique ID that the system uses for each item / subitem.

    If you need a GUID, create a Text category and set the Value data source to Calculated with the following Advance Function.

    //
    // CategoryName = GUID
    // Value Function
    //
    var mngr = getCell("Manager");
    var writeGuid = getCell("GUID").DisplayValue;
    if (writeGuid == null) {
         var guid: System.Guid = System.Guid.NewGuid();
         return guid.ToString();
    }
    return writeGuid;
  • 2. Re: Autonumbering in a category
    ppm user Newbie
    Currently Being Moderated
    Another example if you need to begin incrementing at a certain number:


    var start = 100000;
    var cell = getCell("Status");
    var id = cell.ItemID;
    var result = null;

    if (id>100000){return id+""}
    else{result = start+id};

    return result+"";

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points