ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Auto-Incrementing Custom Weblog Field?

June 12, 2008 4:15pm

Subscribe [2]
  • #1 / Jun 12, 2008 4:15pm

    Michael C.

    29 posts

    Is there any way to have an “increment” field - a custom field in a weblog that holds a numeric value and automatically increments for each entry? The Entry ID is kinda what I’m looking for, except I need the values to be unique only to that weblog, not to the entire site (i.e. Weblog ABC could have entries with “increment” field values of 1, 2, and 3, and Weblog XYZ could also have entries with the “increment” field having values of 1, 2, and 3).

    The reason for this is because I want to have a weblog for registering teams at a competition, where the team number will be automatically generated upon registration. Worst-case scenario, I could use the Entry ID as the Team ID, but I’d rather start from 1, not from 643 (or however many entries are already posted to the site).

    Is there any way to do this?

  • #2 / Jun 18, 2008 11:49am

    grantmx

    1439 posts

    You can use Absolute Count.

  • #3 / Jun 18, 2008 12:31pm

    Michael C.

    29 posts

    Hmm… thanks, but wouldn’t that number change depending on the parameters given to the {exp:weblog:entries} tag? I could just change the sort order from asc to desc and the entries would have different numbers, wouldn’t they? I need something persistent, attached to the weblog entry, not just something for temporary display.

  • #4 / Jun 18, 2008 12:33pm

    grantmx

    1439 posts

    Nope.

  • #5 / Jun 18, 2008 12:47pm

    Michael C.

    29 posts

    Would it change if I went from

    {exp:weblog:entries weblog="weblog1"}
    to
    {exp:weblog:entries weblog="weblog1|weblog2"}

    Right? It would have to…

  • #6 / Jun 18, 2008 12:48pm

    grantmx

    1439 posts

    Its possible, but why would you want to?  Don’t you just want to display only the entries for a specific weblog/team?

  • #7 / Jun 18, 2008 1:04pm

    Michael C.

    29 posts

    Because there’s multiple types of competitions, each type with it’s own list of teams. What if I want to view all the teams from both types of competitions who have a specific status (such as “unpaid”, for example)? If it’s pulling teams from both weblogs (one weblog per competition type), then the team numbers would get all mixed up.

  • #8 / Jun 18, 2008 1:33pm

    grantmx

    1439 posts

    Your original question didn’t mention any other scenario or further data manipulation.  If you want to tag an individual entry with a unique identifier or number that carries over and through any data manipulation and show it, then you have few other choices other than utilizing entry id.

    Otherwise, create a custom field and manually enter the number you need the entry/team to display.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases