Form Fields: Difference between revisions

From IHRIS Wiki
No edit summary
Line 1: Line 1:
Este artículo define los tipos de datos principals o campos de formlarios utilizados por iHRIS. Estos campos se definen en Datos Magic y a continuación se describen los detalles de como deben definirse.   
This article describes the main data types, or form fields, used by iHRIS. These fields are defined in Magic Data, and the details of how they should be defined are described below.   




==Datos Magic para Definir Campos==
==Magic Data for Defining Fields==
Cada clase de formulario $formClass contiene una lista de camposUn campo $field en $formClass se define en:
Each form class $formClass contains a list of fieldsA field $field in $formClass is defined at:
  /modules/forms/formClasses/$formClass/fields/$field
  /modules/forms/formClasses/$formClass/fields/$field
que tiene los siguientes sub-nodos
which has the following sub-nodes
*formfield: Requerido. Las necesidades Deben estar en el campo [[#Field Types|type]] como los  INT
*formfield: Required. Needs should be on of the field [[#Field Types|type]] such as INT
*in_db: OpcionalDebe ser 0 ó 1. Si no está establecido, por defecto es 1.  Si es 1, entonces este campo debe guardarse en la base de datos
*in_db: OptionalIt should be either 0 or 1. If not set, defaults to 1.  If 1, then this field should be saved into the database
*required: OpcionalDebe ser 0 ó 1. Si no está establecido, por defecto es 0. Si es 1, entonces este campo debe establecerse antes de poder considerarlo como válido
*required: OptionalIt should be either 0 or 1. If not set, defaults to 0. If 1, then this field needs to be set before it can be considered valid
*unique: OpcionalDebe ser 0 ó 1. Si no está establecido, por defecto es 0. Si es 1, entonces el valor de este campo debe ser único entre todas las instancias del formulario
*unique: OptionalIt should be either 0 or 1. If not set, defaults to 0. If 1, then the value of this field needs to be unique among all instances of the form
*headers: OpcionalEs un nodo primario, cada nodo secundario es un valor de cadena. Puede escoger un encabezado diferente al especificar elatributo del archive en una plantilla.
*headers: OptionalIt is itself a parent node, each child node is a string value. You can choose a different header by specifying the header attribute in a template file.
**default: Nodo escalar opcionalEl título/encabezado por defecto que se muestra para el campo. Este encabezado se utiliza si no se especifíca ningún atributo de encabezado en la plantilla.
**default: Optional scalar nodeThe default title/header displayed for the field. This header is used if no header attribute is specified in the tempalte.
**$display1: Nodo escalar opcionalMismo que 'por defecto'
**$display1: Optional scalar nodeSame as 'default'
**$display2: Nodo escalar opcionalMismo que 'por defecto'
**$display2: Optional scalar nodeSame as 'default'
**...
**...
===Tipos de Campo===   
===Field Types===   
Cada campo tiene un tipoLos tipos definen como se muestran al usuario en las vistas de edición y sólo lectura. También contiene información acerca del tipo de columna en la que se Deben guarder los datos en una base de datos.
Each field has a typeThe types define how they are displayed to the end user in both an edit and view only context. It also contains information about the type of column the data should be saved in a database.
Los tipos disponibles son:
The available types are:
* [[Class: I2CE_FormField_BOOL |BOOL]] es implementado por la clase I2CE_FormField_BOOL es una elección entre falso y verdadero
* [[Class: I2CE_FormField_BOOL |BOOL]] is implemented by the class I2CE_FormField_BOOL is a choice between true and false
* [[Class: iHRIS_FormField_CURRENCY | CURRENCY]] es implementado por la clase iHRIS_FormField_CURRENCY y es un tipo de moneda y una cantidad
* [[Class: iHRIS_FormField_CURRENCY | CURRENCY]] is implemented by the class iHRIS_FormField_CURRENCY and is a currency type and an amount
* [[Class: I2CE_FormField_DATE_HMS |DATE_HMS]] es implementado por la clase I2CE_FormField_DATE_HMS es solamente una hora
* [[Class: I2CE_FormField_DATE_HMS |DATE_HMS]] is implemented by the class I2CE_FormField_DATE_HMS is a time only
* [[Class: I2CE_FormField_DATE_MD | DATE_MD]] es implementado por la clase I2CE_FormField_DATE_MD es un mes y un día
* [[Class: I2CE_FormField_DATE_MD | DATE_MD]] is implemented by the class I2CE_FormField_DATE_MD is a month and day
* [[Class: I2CE_FormField_DATE_TIME | DATE_TIME]] es implementado por la clase I2CE_FormField_DATE_TIME es un año, mes, día y hora
* [[Class: I2CE_FormField_DATE_TIME | DATE_TIME]] is implemented by the class I2CE_FormField_DATE_TIME is a year, month, day and time
* [[Class: I2CE_FormField_DATE_YMD | DATE_YMD]] es implementado por la clase I2CE_FormField_DATE_YMD y es un año, mes y día
* [[Class: I2CE_FormField_DATE_YMD | DATE_YMD]] is implemented by the class I2CE_FormField_DATE_YMD and is a year, month and day
* [[Class: I2CE_FormField_DATE_Y | DATE_Y]] es implementado por la clase I2CE_FormField_DATE_Y y es un año
* [[Class: I2CE_FormField_DATE_Y | DATE_Y]] is implemented by the class I2CE_FormField_DATE_Y and is a year
* [[Class: I2CE_FormField_INT_GENERATE | INT_GENERATE]] es implementado por la clase I2CE_FormField_INT_GENERATE  y es una secuencia de enteros que llenarán el siguiente valor en la secuencia
* [[Class: I2CE_FormField_INT_GENERATE | INT_GENERATE]] is implemented by the class I2CE_FormField_INT_GENERATE  and is integer sequence that will populate the next value in the sequence
* [[Class: I2CE_FormField_INT | INT]] is implemented by the class I2CE_FormField_INT is an integer
* [[Class: I2CE_FormField_INT | INT]] is implemented by the class I2CE_FormField_INT is an integer
* [[Class: I2CE_FormField_INT_LIST | INT_LIST]] es implementado por la clase I2CE_FormField_INT_LIST is an array of integers
* [[Class: I2CE_FormField_INT_LIST | INT_LIST]] is implemented by the class I2CE_FormField_INT_LIST is an array of integers
* [[Class: I2CE_FormField_INT_RANGE | INT_RANGE]] es implementado por la clase I2CE_FormField_INT_RANGE es una lista en rango de enteros y se introdujo en la versión '''4.1'''.  El rango se especifíca estableciendo inicio (por defecto es 0), final (por defecto es 10) y paso (por defecto 1) en la secciñon meta de las opciones del campo.
* [[Class: I2CE_FormField_INT_RANGE | INT_RANGE]] is implemented by the class I2CE_FormField_INT_RANGE is a ranged drop down of integers and was introduced in version '''4.1'''.  The range is specified by setting start (defaults to 0), end (defaults to 10) and step (defaults to 1) in the meta section of the field's options.
* [[Class: I2CE_FormField_MAP | MAP]] es implementado por la clase I2CE_FormField_MAP y es el nombre y la id de un formulario de lista
* [[Class: I2CE_FormField_MAP | MAP]] is implemented by the class I2CE_FormField_MAP and is the name and id of a list form
* [[Class: I2CE_FormField_MAP_MULT |MAP_MULT]] es implementado por la clase I2CE_FormField_MAP_MULT  y es un arreglo de nombres y ids para la lista de los formularios
* [[Class: I2CE_FormField_MAP_MULT |MAP_MULT]] is implemented by the class I2CE_FormField_MAP_MULT  and is an array of names and ids for list forms
* [[Class: I2CE_FormField_REFERENCE | REFERENCE]] es un campo que es una referencia a otro formulario y cuyo valor de display se basa en los campos de ese formulari referenciadoPuede ver la definición [[Reference Field | aquí]]
* [[Class: I2CE_FormField_REFERNCE | REFERENCE]] is a field which is a reference to another form and whose display value is based on the fields in that referenced formYou can see the defintion [[Reference Field | here]]
* [[Class: I2CE_FormField_STRING_LINE |STRING_LINE]] es implementado por la clase I2CE_FormField_STRING_LINE es una cadena
* [[Class: I2CE_FormField_STRING_LINE |STRING_LINE]] is implemented by the class I2CE_FormField_STRING_LINE and is a string
* [[Class: I2CE_FormField_STRING_MLINE | STRING_MLINE]] es implementado por la clase I2CE_FormField_STRING_MLINE y es una cadena multi-línea
* [[Class: I2CE_FormField_STRING_MLINE | STRING_MLINE]] is implemented by the class I2CE_FormField_STRING_MLINE and is multi-line string
* [[Class: I2CE_FormField_STRING_PASS | STRING_PASS]] es implementado por la clase I2CE_FormField_STRING_PASS es un valor de contraseña
* [[Class: I2CE_FormField_STRING_PASS | STRING_PASS]] is implemented by the class I2CE_FormField_STRING_PASS is a password value
* [[Class: I2CE_FormField_STRING_TEXT | STRING_TEXT]] es implementado por la clase I2CE_FormField_STRING_TEXT y es una cadena grande de multi-líneas
* [[Class: I2CE_FormField_STRING_TEXT | STRING_TEXT]] is implemented by the class I2CE_FormField_STRING_TEXT is a large multi-line string
* [[Class: I2CE_FormField_YESNO | YESNO]] es implementado por la clase I2CE_FormField_YESNO y es una elección entre Si y No
* [[Class: I2CE_FormField_YESNO | YESNO]] is implemented by the class I2CE_FormField_YESNO and is a choice between Yes and No


==Campos Map==
==Map Fields==
Un MAP o MAP_MULT toma valor en una lista, que es cualquier formulario cuya clase que implementa es una sub-clase de I2CE_List.  Hay algunas opciones especiales para la forma en que se muestran estas listas.
A MAP or MAP_MULT takes values in a list, which is any form whose implementing class subclasses I2CE_List.  There are some special options for how these lists are displayed.


===Datos Magic Meta para Campos Fields===
===Meta Magic Data for MAP Fields===
Un campo de tipo MAP o MAP_MULT puede especificar el siguiente sub-nodo 'por defecto' .   
A field of type MAP or MAP_MULT can specify the following 'default'  sub-node.   
Bajo el nodo de datos magic:
Under the magic data node:
  /modules/forms/formClasses/$formClass/fields/$field/meta
  /modules/forms/formClasses/$formClass/fields/$field/meta
Podemos especificar más información que afecta como se utiliza un campo de la siguiente manera:
We can specify some further information which affects how a field is used as follows:
*form: un nodo primario opcionalLos nodos secundarios on todos escalares que especifican los formularios en los que este campo puede tomar valores. Si no se establece, el nombre del formulario se assume como el nombre del campo, $field.
*form: an optional parent nodeThe child nodes are all scalar nodes which specify the forms that this field can take values in. If not set, the name of the form is assumed to be the name of the field, $field.
*display: un nodo primario opcionalCada nodo secundario es "named" mostrado para ese campo que puede referenciarse en archivos de plantillas .html .   
*display: An optional parent nodeEach child node is a "named" display for that field which can be referenced in .html templale files.   
**default: un nodo primario opcionalAl mostrar un campo, si no se especifíca el display, se utiliza el nodo "default" para determinar el display.
**default: Optional parent nodeWhen displaying a field, if no display is specified, the data under the node "default" is used to determine the display.
***fields:  Nodo escalar opcionalEste nodo describe la jerarquía de como se deben mostrar los datos, por ejemplo, en una vista de árbol de llos mosmos, al seleccionar el valor de est campo. Tiene la estructura general "mapform1+mapfield1:mapform2+mapfield2:...:mapformN".  Si el ''+mapFieldX'' no está presente, entonces utiizamos ''mapFormX+1'' para el valor de ''mapFieldX''.  Si la entrada de los 'fields' no está establecida, entonces el nombre del campo es el formulario mapeado.  <br/> Cuando seleccionamos un valor para el campo, empezamos por mostrar todos los valores para ''mapFormN''.  Bajo cada uno de estos valores, mostramos todos los valores de ''mapFormN-1'' cuyo campo ''mapFieldN-1'' es ''mapFormN''  es y continuamos hasta llegar a ''mapForm1''.  <br/> Si ''mapFormXX+mapFieldXX'' esta rodeado por por corchetes cuadrados, [ ],  entonces no mostramos los datos de ese formulario mapeado.
***fields:  Optional scalar nodeThis node describe the hierarchy of how the data should be displayed, for example, in a tree view of the data, when selecting the value of this field. It has the general structure "mapform1+mapfield1:mapform2+mapfield2:...:mapformN".  If the ''+mapFieldX'' is not present, then we use ''mapFormX+1'' for the value of ''mapFieldX''.  If the 'fields' entry is is not set, then it is the mapped form is the the name of field.  <br/> When we select a value for the field, we start by displaying all the values for ''mapFormN''.  Under each one of these values, we display all values for ''mapFormN-1'' whose field ''mapFieldN-1'' is ''mapFormN''  is and continue down until we get to ''mapForm1''.  <br/> If ''mapFormXX+mapFieldXX'' is surrounded in square brackets, [ ],  then we don't display the data for that mapped form.
***orders:un nodo primario opcionalLos nodos secundarios tienen nombres que son formularios que podemos seleccionar por el campo:
***orders: An optional parent nodeChild nodes have names which are forms which are selectable by the field:
****$form1: un nodo primario opcional. Los secundarios son nodos escalares con claves enteros y valores del nombre del campo. Si este nodo está establecido, entonces sobreescribirá cualquier valor que se establezca bajo el nodo de datos magic: /modules/forms/formClasses/$form1/meta/list/default/sort_fields.  <p/>'''Note''': even if this is $display1, then it will still look at default/sort_fields rather than $display1/sort_fields)
****$form1: Optional parent node. Children are scalar nodes with keys integers and values the name of the field. If this node is set, then it will override any values that are set under the magic data node: /modules/forms/formClasses/$form1/meta/list/default/sort_fields.  <p/>'''Note''': even if this is $display1, then it will still look at default/sort_fields rather than $display1/sort_fields)
****$form2: Nodo primario opcionalMisma estructura que $form1.
****$form2: Optional parent nodeSame structure as in $form1.
****...:
****...:
**$display1: Nodo primario opcional. La estructura es la misma que el display "por defecto" .
**$display1: Optional parent node. Structure is the same as the "default" display.
**$display2: Nodo primario opcional. La estructura es la misma que el display "por defecto" .
**$display2: Optional parent node. Structure is the same as the "default" display.
**...
**...
*limits:  Nodo primario opcionalLos nodos secundarios describen los límites que deben aplicarse al llenar la lista o el árbol de entradas válidas
*limits:  Optional parent nodeChild nodes describe any limits that should be applied when populating the list or tree of valid entries
**default: Nodo primario opcionallímites que se aplican al display por defecto. Los secundarios se nombran para cada una de los formularios que podemos seleccionar referenciados en la lista de 'form' anterior.
**default: Optional parent nodeLimits that apply to the default display. Child nodes are named for each of the selectable forms referenced in list of forms 'form' above.
***$form1:  Nodo primario opcionalLímites que aplican al ller los datos de $form1 en la base de datosLa estructura de este nodo es la misma estructura de [[Limiting Forms]]
***$form1:  Optional parent nodeLimits that apply when reading the data from $form1 in the databaseThe structure of this node is the same structure as [[Limiting Forms]]
***$form2: Nodo primario opcionalLímites que aplican al leer los datos de $form2 en la base de datosLa estructura de este node es la misma estructura de [[Limiting Forms]]
***$form2: Optional parent nodeLimits that apply when reading the data from $form2 in the databaseThe structure of this node is the same structure as [[Limiting Forms]]
***...
***...
**$display1: Nodo primario opcionalLímites que aplican al display $display1.  Misma estructura que 'por defecto'
**$display1: Optional parent nodeLimits that apply to the display $display1.  Same structure as 'default'
**...
**...






Vea también:  [[Defining Forms#Lists | Defining List Forms]]
See also:  [[Defining Forms#Lists | Defining List Forms]]


===Ejemplo de Datos Magic Meta===
===Meta Magic Data Example===
Por ejemplo, iHRIS_Person tiene un campo mapeado, 'residence'.  Su nodo meta contiene los siguientes sub-nodos:
For example, iHRIS_Person has a mapped field, 'residence'.  It's meta node contains the following sub-nodes:
<source lang='php'>
<source lang='php'>
'form' => Array [
'form' => Array [
Line 91: Line 91:
]  
]  
</source>
</source>
También puede ver [http://bazaar.launchpad.net/~intrahealth+informatics/ihris-common/4.0-dev/view/head:/modules/Person/Person.xml#L208 .xml] que se utiliza para definir esto en los datos magic para el modulo de Person en iHRIS Common.
You can also see the [http://bazaar.launchpad.net/~intrahealth+informatics/ihris-common/4.0-dev/view/head:/modules/Person/Person.xml#L208 .xml] used to define this in the magic data for the Person module in iHRIS Common.


En este caso, el nodo 'forms' nos dice que cualquier miembro de la lista de distritos o condados se puede escoger como la residencia de una persona.
In this case, the 'forms' node tell us that any member of the county or district list may be chosen as the residence for a person.


En el ejemplo anterior, al seleccionar una residencia para una persona, primero debe escoger el país, luego la región, luego el distritoPuede especificar aún más el condado. Cuando se muestre una residencia se verá como:
In the above example, when selecting a residence for a person, you first choose the country, then the region, then the districtYou may further specify the county. When displaying a selected residence it will display either:
  District, Country
  District, Country
o
or
  County, Country District
  County, Country District
dependiendo se si seleccionó el distrito o condado.
depending if you have selected the district or county.


== Enteros Generados Automáticamente INT_GENERATE) ==
== Automatically Generated Integers (INT_GENERATE) ==


Los enteros generados automaticámente (o INT_GENERATE) se utilizan cuando un formulario necesita usar un número incrementado para una ID pero los datos entrantes pueden no saber cual es el siguiente valor disponible. El usuario puede hacer click en un cuadro para incrementar al siguiente valor o si es necesario puede escribir el nombre si se conoceDesde la cersión 4.0.2 INT_GENERATE solamente se soporta cuando el format utiliza el mecanismo de almacenamiento del formularioUtiliza la tabla de field_sequence para llevar un registro del valor máximo actual para cada campo de formulario.
Automatically generated integers (or INT_GENERATE) are used when a form needs an incremented number to use for an ID but the data entrant may not know what the next available value is. The user can check a checkbox to increment to the next value or if necessary can type in the number if it is knownAs of version 4.0.2 INT_GENERATE is only supported when the form uses the entry form storage mechanismIt uses the field_sequence table to keep track of the current maximum value for each form field.
 
In the field_sequence table there will be an entry with the form field id and the highest value that has been used.  The system checks two possibilities for determining the next available number.  It looks at the field_sequence table if a row exists there for the form field and in the last_entry table for the highest assigned value.  Whichever is higher is then incremented by one and saved to the field_sequence table so it can be accessed the next time a record is added.
 
If you want to start at 1000 you can just add the form field id and 1000 to field_sequence.  You only need to add something to the field_sequence table if you want it to start higher than the currently saved values.  For example, if you imported data that ranges from 100-400 but you want the generated numbers to start at 1000 then you’ll need to add a row to the field_sequence table.  But if you just want the next number to be 401 then you don’t need to do anything.


En la tabla field_sequence habrá una entrada con la id del campo del formulario y el valor más alto que se ha utilizado. El sistema revisa dos posibilidades para determiner el siguiente número disponible. Ve en la tabla de field_sequence si existe una fila para el campo del formulario y en la tabla de last_entry el valor mas alto assignado. El más alto de los dos se incrementa en uno y se guarda en la tabla de field_sequence para que sea accessible la próxima vez que se añade un registro.


Si quiere empezar en 1000 puede solamente agregar la id de campo de formulario y 1000 a field_sequence.  Solamente debe añadir algo a la tabla field_sequence si quiere estar en un valor más alto que los valores guardados actualmente. Por ejemplo, si ha importado datos que van en un rango de 100-400 pero quiere que los númerous generados empiecen en 1000 entonces necesita agregar una fila a la tabla de field_sequence .  Pero si solamente quiere que el próximo número sea 401 entonces no debe hacer nada.


[[Category:Technical Overview]][[Category:Forms]][[Category:Review2013]][[Category:Needs Intro]]
[[Category:Technical Overview]][[Category:Forms]][[Category:Review2013]][[Category:Needs Intro]]

Revision as of 21:09, 30 September 2013

This article describes the main data types, or form fields, used by iHRIS. These fields are defined in Magic Data, and the details of how they should be defined are described below.


Magic Data for Defining Fields

Each form class $formClass contains a list of fields. A field $field in $formClass is defined at:

/modules/forms/formClasses/$formClass/fields/$field

which has the following sub-nodes

  • formfield: Required. Needs should be on of the field type such as INT
  • in_db: Optional. It should be either 0 or 1. If not set, defaults to 1. If 1, then this field should be saved into the database
  • required: Optional. It should be either 0 or 1. If not set, defaults to 0. If 1, then this field needs to be set before it can be considered valid
  • unique: Optional. It should be either 0 or 1. If not set, defaults to 0. If 1, then the value of this field needs to be unique among all instances of the form
  • headers: Optional. It is itself a parent node, each child node is a string value. You can choose a different header by specifying the header attribute in a template file.
    • default: Optional scalar node. The default title/header displayed for the field. This header is used if no header attribute is specified in the tempalte.
    • $display1: Optional scalar node. Same as 'default'
    • $display2: Optional scalar node. Same as 'default'
    • ...

Field Types

Each field has a type. The types define how they are displayed to the end user in both an edit and view only context. It also contains information about the type of column the data should be saved in a database. The available types are:

  • BOOL is implemented by the class I2CE_FormField_BOOL is a choice between true and false
  • CURRENCY is implemented by the class iHRIS_FormField_CURRENCY and is a currency type and an amount
  • DATE_HMS is implemented by the class I2CE_FormField_DATE_HMS is a time only
  • DATE_MD is implemented by the class I2CE_FormField_DATE_MD is a month and day
  • DATE_TIME is implemented by the class I2CE_FormField_DATE_TIME is a year, month, day and time
  • DATE_YMD is implemented by the class I2CE_FormField_DATE_YMD and is a year, month and day
  • DATE_Y is implemented by the class I2CE_FormField_DATE_Y and is a year
  • INT_GENERATE is implemented by the class I2CE_FormField_INT_GENERATE and is integer sequence that will populate the next value in the sequence
  • INT is implemented by the class I2CE_FormField_INT is an integer
  • INT_LIST is implemented by the class I2CE_FormField_INT_LIST is an array of integers
  • INT_RANGE is implemented by the class I2CE_FormField_INT_RANGE is a ranged drop down of integers and was introduced in version 4.1. The range is specified by setting start (defaults to 0), end (defaults to 10) and step (defaults to 1) in the meta section of the field's options.
  • MAP is implemented by the class I2CE_FormField_MAP and is the name and id of a list form
  • MAP_MULT is implemented by the class I2CE_FormField_MAP_MULT and is an array of names and ids for list forms
  • REFERENCE is a field which is a reference to another form and whose display value is based on the fields in that referenced form. You can see the defintion here
  • STRING_LINE is implemented by the class I2CE_FormField_STRING_LINE and is a string
  • STRING_MLINE is implemented by the class I2CE_FormField_STRING_MLINE and is multi-line string
  • STRING_PASS is implemented by the class I2CE_FormField_STRING_PASS is a password value
  • STRING_TEXT is implemented by the class I2CE_FormField_STRING_TEXT is a large multi-line string
  • YESNO is implemented by the class I2CE_FormField_YESNO and is a choice between Yes and No

Map Fields

A MAP or MAP_MULT takes values in a list, which is any form whose implementing class subclasses I2CE_List. There are some special options for how these lists are displayed.

Meta Magic Data for MAP Fields

A field of type MAP or MAP_MULT can specify the following 'default' sub-node. Under the magic data node:

/modules/forms/formClasses/$formClass/fields/$field/meta

We can specify some further information which affects how a field is used as follows:

  • form: an optional parent node. The child nodes are all scalar nodes which specify the forms that this field can take values in. If not set, the name of the form is assumed to be the name of the field, $field.
  • display: An optional parent node. Each child node is a "named" display for that field which can be referenced in .html templale files.
    • default: Optional parent node. When displaying a field, if no display is specified, the data under the node "default" is used to determine the display.
      • fields: Optional scalar node. This node describe the hierarchy of how the data should be displayed, for example, in a tree view of the data, when selecting the value of this field. It has the general structure "mapform1+mapfield1:mapform2+mapfield2:...:mapformN". If the +mapFieldX is not present, then we use mapFormX+1 for the value of mapFieldX. If the 'fields' entry is is not set, then it is the mapped form is the the name of field.
        When we select a value for the field, we start by displaying all the values for mapFormN. Under each one of these values, we display all values for mapFormN-1 whose field mapFieldN-1 is mapFormN is and continue down until we get to mapForm1.
        If mapFormXX+mapFieldXX is surrounded in square brackets, [ ], then we don't display the data for that mapped form.
      • orders: An optional parent node. Child nodes have names which are forms which are selectable by the field:
        • $form1: Optional parent node. Children are scalar nodes with keys integers and values the name of the field. If this node is set, then it will override any values that are set under the magic data node: /modules/forms/formClasses/$form1/meta/list/default/sort_fields.

          Note: even if this is $display1, then it will still look at default/sort_fields rather than $display1/sort_fields)

        • $form2: Optional parent node. Same structure as in $form1.
        • ...:
    • $display1: Optional parent node. Structure is the same as the "default" display.
    • $display2: Optional parent node. Structure is the same as the "default" display.
    • ...
  • limits: Optional parent node. Child nodes describe any limits that should be applied when populating the list or tree of valid entries
    • default: Optional parent node. Limits that apply to the default display. Child nodes are named for each of the selectable forms referenced in list of forms 'form' above.
      • $form1: Optional parent node. Limits that apply when reading the data from $form1 in the database. The structure of this node is the same structure as Limiting Forms
      • $form2: Optional parent node. Limits that apply when reading the data from $form2 in the database. The structure of this node is the same structure as Limiting Forms
      • ...
    • $display1: Optional parent node. Limits that apply to the display $display1. Same structure as 'default'
    • ...


See also: Defining List Forms

Meta Magic Data Example

For example, iHRIS_Person has a mapped field, 'residence'. It's meta node contains the following sub-nodes: <source lang='php'> 'form' => Array [

         0 => county
         1 => district
         ],

'display' => Array [

     'default' => Array [
       'fields' => county:district:[region]:country 
       ] 
   ],

'limits' => Array [

   'default'=> Array [
       'country'=> Array[
           'operator'=>'FIELD_LIMIT',
           'field'=>'location',
           'style'=>'yes'
        ]
    ] 

] </source> You can also see the .xml used to define this in the magic data for the Person module in iHRIS Common.

In this case, the 'forms' node tell us that any member of the county or district list may be chosen as the residence for a person.

In the above example, when selecting a residence for a person, you first choose the country, then the region, then the district. You may further specify the county. When displaying a selected residence it will display either:

District, Country

or

County, Country District

depending if you have selected the district or county.

Automatically Generated Integers (INT_GENERATE)

Automatically generated integers (or INT_GENERATE) are used when a form needs an incremented number to use for an ID but the data entrant may not know what the next available value is. The user can check a checkbox to increment to the next value or if necessary can type in the number if it is known. As of version 4.0.2 INT_GENERATE is only supported when the form uses the entry form storage mechanism. It uses the field_sequence table to keep track of the current maximum value for each form field.

In the field_sequence table there will be an entry with the form field id and the highest value that has been used. The system checks two possibilities for determining the next available number. It looks at the field_sequence table if a row exists there for the form field and in the last_entry table for the highest assigned value. Whichever is higher is then incremented by one and saved to the field_sequence table so it can be accessed the next time a record is added.

If you want to start at 1000 you can just add the form field id and 1000 to field_sequence. You only need to add something to the field_sequence table if you want it to start higher than the currently saved values. For example, if you imported data that ranges from 100-400 but you want the generated numbers to start at 1000 then you’ll need to add a row to the field_sequence table. But if you just want the next number to be 401 then you don’t need to do anything.