Difference between revisions of "Dataobjref field"

From EPrints Documentation
Jump to: navigation, search
(Added dataobjref metadata field type)
 
(Actually leave in as should become available)
 
(3 intermediate revisions by the same user not shown)
Line 14: Line 14:
  
 
{| border="1" cellpadding="3" cellspacing="0"
 
{| border="1" cellpadding="3" cellspacing="0"
| name || default || description
+
! Name || Default Value || Required || Description  || Notes
 
|-
 
|-
| '''datasetid''' || n/a || '''This property is always required.'''
+
| '''datasetid''' || n/a || YES || The ID of the dataset that reference data object belongs. ||
 
|-
 
|-
| '''input_lookup_url''' || lookup/dataobjref || '''The CGI script path to use to lookup data objects.'''
+
| '''input_lookup_url''' || <tt>lookup/dataobjref</tt> || NO || The CGI script path to use to lookup data objects. ||
 
|-
 
|-
 +
| '''match''' || <tt>IN</tt> || NO || How to match this fields values in searches. || Different to parent default (<tt>EQ</tt>).
 +
|-
 +
| '''text_index''' || <tt>1</tt> || NO || Whether the text for these fields should be indexed. || Different to parent default (<tt>0</tt>).
 
|}
 
|}
  
Line 30: Line 33:
  
 
== API ==
 
== API ==
See [[API:EPrints/MetaField/Itemref|API page]].
+
See [[API:EPrints/MetaField/Dataobjref|API page]].
  
 
== Examples ==
 
== Examples ==

Latest revision as of 09:50, 9 July 2024

EPrints 3 Reference: Directory Structure - Metadata Fields - Repository Configuration - XML Config Files - XML Export Format - EPrints data structure - Core API - Data Objects


Metadata Fields: Arclanguage - Base64 - Bigint - Boolean - Compound - Counter - Dataobjref - Date - Decimal - Email - Fields - Float - Id - Idci - Image - Int - Itemref - Keywords - Langid - Longtext - Longtext_counter - Multilang - Multipart - Name - Namedset - Pagerange - Recaptcha - Recaptcha3 - Relation - Search - Secret - Set - Storable - Subject - Subobject - Text - Time - Timestamp - Url - Uuid


Description

This field allows another data object, which belongs to a specified datasetid to be referenced. This is a bit like an Itemref field but allows multiple fields from another data object to be stored with the ID of the data object referenced.

Inheritance

Additional Properties

As for Compound fields except for:

Name Default Value Required Description Notes
datasetid n/a YES The ID of the dataset that reference data object belongs.
input_lookup_url lookup/dataobjref NO The CGI script path to use to lookup data objects.
match IN NO How to match this fields values in searches. Different to parent default (EQ).
text_index 1 NO Whether the text for these fields should be indexed. Different to parent default (0).

Required Phrases

No additional phrases beyond those required for Compound fields.

Database

Itemref fields are stored in the database as

fieldname INT(11)

API

See API page.

Examples

Most basic example. (Captures an associated user title with its ID).

{
    name => 'userid',
    type => 'dataobjref',
    datasetid => 'user',
    fields => [ 
        { 
            sub_name => 'title', 
            type => 'text',
        } 
    ],
}

Capture multiple data object references.

{
    name => 'funders',
    type => 'dataobjref,
    datasetid => 'funder',
    multiple => 1,
    fields => [
        { 
            sub_name => 'name',
            type => 'text' 
        },
    ],
}

Use bespoke lookup URL.

{
    name => 'eprintid',
    type => 'dataobjref',
    datasetid => 'eprint',
    input_lookup_url => 'lookup/mydataobjref',
    fields => [ 
        { 
            sub_name => 'title', 
            type => 'text',
        },
        { 
            sub_name => 'date', 
            type => 'date',
        } ,
    ],
}