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 Increment Field

January 09, 2010 7:19pm

Subscribe [3]
  • #1 / Jan 09, 2010 7:19pm

    bjyama

    38 posts

    I am working on an online sheet music library database using EE 1.6.8

    I have set up a weblog, categories and field groups. However every time a new entry is submitted I would like a unique number (a catalog number) to be automatically assigned to each entry.

    I know that EE assigns an entry id but I would like the catalog numbers to be independent of the rest of the site.

    Is this easily possible or do I need to go into custom work?

  • #2 / Jan 10, 2010 12:58pm

    Herb

    224 posts

    This would be in the form of a custom field and would require an operation that is not native to expression engine to populate and would require an extension to determine the correct catalog item id to insert when new items are added.

  • #3 / Jan 10, 2010 7:34pm

    Kevin Gerich

    213 posts

    I believe you can only have one auto-increment field per table and it has to be the primary key.
    What you want would probably require some custom work.

    Jim

  • #4 / Jan 10, 2010 8:35pm

    Kevin Gerich

    213 posts

    Just a thought, you could use the entry date, I think its in universal time and is pretty much assured to be unique unless 2 entries go in at exactly the same time.
    Thought I think you would need to use a query to read it back in that format.

    Jim

  • #5 / Jan 10, 2010 8:53pm

    Herb

    224 posts

    Just a thought.  Is this commercial sheet music or something you have created on your own, or both?

    How do you intend to use this product ID?

    Are you going to be the sole creater of entries of this sheet music?

    My line of thinking is that you can use something other than a sequentially ascending number.  Perhaps an ISBN type number, or something you would concoct that uniquely identifies that particular sheet of music.  I believe you are looking for an identifier to uniquely distinguish between one sheet and another.

    The only other method I can think of would require at a minimum an extension that hooks into the publish and edit forms.

  • #6 / Jan 10, 2010 10:07pm

    bjyama

    38 posts

    I run a Solo and Ensemble Festival in Honolulu. This is a music listing of approved solo and ensemble pieces to be performed. The unique ID is used within another database application for scheduling and logistics. It just needs to be a unique id, yes like a primary key and I was hoping there was an easy way I could get EE to do this.

    Thanks for your comments, I may look into doing some custom work later but for the moment I think we will just need to do without it.

  • #7 / Jan 10, 2010 10:29pm

    Kevin Gerich

    213 posts

    So, I guess I really don’t understand why the entry_id won’t do what you need it to.
    A unique id is a unique id??????

    if you want a higher number like 100234.
    Go in and reset the start point of the auto increment to 100000.
    Then you will always have a 6 digit identifier.

    jim

  • #8 / Jan 11, 2010 2:13am

    bjyama

    38 posts

    @Jim The entry id is a unique id and I am going to use it for that purpose, it just isn’t ideal. Because an entry id is assigned to every entry and not just entries from this particular weblog there are going to be gaps in the sequence when other things are added elsewhere on the site. This isn’t a deal breaker, I just wanted to know if it was possible out of the box.

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

ExpressionEngine News!

#eecms, #events, #releases