19/Campos de la base de datos

De MoodleDocs

Podemos agregar muchos tipos de campos que formarán parte de nuestrabase de datos. Cada campo admite distintos tipos de datos, con diferentes interfaces. Después de crear los campos deseados podemos añadir información en la base de datos.

Nota: Pendiente de Traducir. ¡Anímese a traducir esta página!.     ( y otras páginas pendientes)

Primero, crear un campo

Un campo es el nombre de la unidad de información. Cada entrada en una base de datos puede tener múltiples campos de diversos tipos e.g. a text field called 'favourite color' which allows you to type in your favourite shade, or a menu called 'state' that lets you choose one from a list of the 50 that make up the United States of America. By combining several fields with appropriate names and types you should be able to capture all the relevant information about the items in your database.

Nombre y descripción del campo

Todos los campos necesitan un nombre y una descripción cuando se crean.


Tipos de campos

Caja de selección

Permite crear una o más cajas de selección. Cada línea escrita en las 'opciones' aparecerá como una caja de selección diferente en la ventana de edición de la entrada. Al editar la entrada podremos seleccionar una o más de las opciones y al visualizar la entrada aparecerá en el campo correspondiente el texto de la o las opción/es seleccionada/s (en el caso de que se haya seleccionado más de una opción aparecerán la una bajo la otra, no en la misma línea). Los Botones de radio se pueden utilizar si se desea que el usuario, al editar la entrada, seleccione tan sólo una de las opciones.

Las cajas de selección múltiple se pueden utilizar, por ejemplo, en una base de datos de películas, que pueden ser de horror, comedia, del oeste, etc. En este caso se podrían seleccionar combinaciones de géneros, por ejemplo horror-comedia o comedia-del oeste.

El campo Menú (selección múltiple) también permite una selección de opciones, pero en este caso clicando en un menú (lo cual a menudo no resulta tan obvio como seleccionar una opción).

Fecha

Permite que los usuarios entren una fecha seleccionando en un listado desplegable el día, mes y año correspondientes.

Archivo

Permite que los usuarios suban un fichero desde su ordenador. Si se trata de un fichero de imagen sería mejor opción seleccionar el campo 'dibujo'.

Menú

The text entered in the options area will be presented as a drop-down list for the user to choose from. Each line become a different option.

Menú (selección múltiple)

The text entered in the options area will be presented as a list for the user to choose from and each line become a different option. By holding down control or shift as they click, users will be able to select multiple options. This is a fairly advanced computer skill so it may be wise to use multiple checkboxes instead.

Número

Asks the user to enter a number. The number must be an integer, though it can be negative ( e.g. ...,-2,-1,0,1,2,3,...). If you enter anything else but numbers and a leading minus sign the number will be truncated or converted to zero e.g. "3.14" becomes "3", "1,000,000" becomes "1" and "six" becomes "0".

Dibujo

The user can upload an image file from their computer.

Botones de radio

Allows the user to choose one from a range of options. If the user doesn't select any of these options then they will be prompted to do so and can only submit the entry when one option is chosen.

If you only have two options and they are opposites (true/false, yes/no) then you could simply use a single checkbox instead. However checkboxes default to their unchecked status and so people could submit without actively selecting one of the options. This may not always be appropriate.

Texto

Users can enter text up to 60 characters in length. For longer text, or for text that requires formatting such as headers and bullet points, you can use a textarea field.

Área de texto

Allows users to enter a long piece of text including formatting similar to that found when creating forum posts.

URL

Ask the user to enter a URL. If you select autolink then the URL becomes a clickable link. If you also enter a forced name for the link then that text will be used for the hyperlink. For example in a database of author's you may wish people to enter the author's website. If you enter the text 'homepage' as a forced name then clicking on text "homepage" will take you to the entereed URL.