Jump to content

Counter field: Difference between revisions

From EPrints Documentation
Removed link to API page (just a redirect to this)
Reinstate link to API page even though a redirect
 
Line 24: Line 24:
Counter fields are stored in the database as
Counter fields are stored in the database as
  fieldname INT(11)
  fieldname INT(11)
== API ==
See [[API:EPrints/MetaField/Counter|API page]].


== Examples ==
== Examples ==

Latest revision as of 09:49, 9 July 2024


Description[edit]

This field represents an integer whose default value is an incrementing integer (1,2,3 ...).

Inheritance[edit]

Additional Properties[edit]

As for Int fields except for:

Name Default Value Required Description Notes
sql_counter n/a YES The counter name for this field that appears as counters database table.

Required Phrases[edit]

No additional phrases beyond those required for Int fields.

Database[edit]

Counter fields are stored in the database as

fieldname INT(11)

API[edit]

See API page.

Examples[edit]

Most basic example. sql_counter is required but typically would be set to the same as name.

{
    name => "mycounter",
    type => "counter",
    sql_counter => "mycounter"
}

Typically, you would not want to allow a value for this field to be imported or cloned as it is an auto-incremented field.

{  
    name => "subjectcounter", 
    type => "counter", 
    required => 1, 
    import => 0, 
    can_clone => 0, 
    sql_counter => "subjectcounter" 
},