223
222
<sect2 id="viewing-and-entering-data">
224
<title>Viewing and Entering Data</title>
225
<para>When in <literal>Data Mode</literal>, you can view or enter information in either the <literal>List</literal> or <literal>Details</literal> view.</para>
223
<title>Ver e introducir datos</title>
224
<para>Cuando trabaje en el <literal>Modo de datos</literal>, puede introducir información en la <literal>Lista</literal> o en la vista de <literal>Detalles</literal>.</para>
227
226
<sect3 id="the-list-view">
228
<title>The List View</title>
229
<para>The List view shows many records at once and usually shows only the most important fields.</para>
227
<title>La vista de lista</title>
228
<para>La vista de lista muestra cuántos registros a la vez y habitualmente muestra sólo los campos más importantes.</para>
230
229
<para>Cuando introduzca datos en un campo se guardarán en la base de datos inmediatamente después de que termine de editarlo. Si es un campo de fecha u hora el formato se comprobará automáticamente.</para>
231
<para>To create a new record just click the <literal>New</literal> button, or start typing into a field in the last empty row. A new record row will be created with blank fields for you to fill in.</para>
230
<para>Para crear un nuevo registro simplemente pulse el botón <literal>Nuevo</literal>, o empiece a escribir en un campo en la última fila vacía. Se creará un nuevo registro con los campos en blanco para que los rellene.</para>
233
232
<figure id="operator-data-list">
234
<title>The List View</title>
233
<title>La vista de lista</title>
237
236
<imageobject><imagedata fileref="figures/glom_data_list.png" format="PNG"/>
240
<phrase>The List View.</phrase>
239
<phrase>La vista de lista.</phrase>
246
<para>To sort the records just click on a column header. For instance, you could might click on a date column to list invoices in order of their date, and click again to list them in reverse order.</para>
245
<para>Para ordenar los registros, simplemente pulse en la cabecera de una columna. Por ejemplo, puede querer pulsar sobre una columna de fecha para listar facturas por su fecha, y pulsar de nuevo para listarlas en orden inverso.</para>
249
248
<sect3 id="the-details-view">
250
<title>The Details View</title>
251
<para>The details view shows only one record and usually shows all the fields arranged suitably.</para>
249
<title>La vista de detalles</title>
250
<para>La vista de detalles muestra un único registro, y habitualmente muestra todos los campos ordenados adecuadamente.</para>
252
251
<para>Cuando introduzca datos en un campo se guardarán en la base de datos inmediatamente después de que termine de editarlo. Si es un campo de fecha u hora el formato se comprobará automáticamente.</para>
253
252
<para>Para crear un nuevo registro pulse el botón <literal>Nuevo</literal>. Se creará un nuevo registro con los campos vacíos para que los pueda rellenar.</para>
255
254
<figure id="operator-data-details">
256
<title>The Details View</title>
255
<title>La vista de detalles</title>
259
258
<imageobject><imagedata fileref="figures/glom_data_details.png" format="PNG"/>
262
<phrase>The Details View.</phrase>
261
<phrase>La vista de detalles.</phrase>
415
414
<sect2 id="users-administration">
416
415
<title>Administración de usuarios</title>
417
<para>To define the <literal>Operators</literal> who can use your database, and to specify what access they have to the various tables, choose <literal>Users</literal> from the <literal>Developer</literal> menu.</para>
416
<para>Para definir los <literal>Operadores</literal> que pueden utilizar su base de datos y para especificar que acceso tienen a las distintas tablas, seleccione <literal>Usuarios</literal> del menú <literal>Desarrollador</literal>.</para>
418
417
<!-- TODO: screenshot -->
421
420
<sect2 id="translations">
422
<title>Translations</title>
423
<para>Glom's user interface (and this document) is translated into several languages, as you should see already if you are using your computer with a non-English user interface. In addition, Glom automatically shows and understands numbers and dates according to the current user's local conventions. For instance, a user in the USA might enter a price as 1.99 and a date as 1/13/2008, but a German user of the same database will later see that as 1,99 and 13.1.2008.</para>
424
<para>However, the Glom system that you create also contains text that must be translated if it will be used by people who speak different languages. For instance, you must provide translations for the titles of your tables, fields, and reports. All of these text items can be seen in a list when you choose <literal>Translations</literal> from the <literal>Developer</literal> menu. In this window you can specify the language that you used for the original text, and enter translations for each text item for additional languages. When the Glom system is opened by a user of that language then these
425
text items will be shown in the user interface.</para>
421
<title>Traducciones</title>
422
<para>La interfaz de usuario de Glom (y este documento) está traducido a varios idiomas, como ya debería poder ver si utiliza un equipo con un interfaz de usuario que no esté en inglés. Además, Glom entiende y muestra automáticamente números y fechas de acuerdo a las convenciones actuales de localización del usuario. Por ejemplo, un usuario en EE. UU. debe introducir un precio como 1.99 y una fecha como 1/13/2008, pero un usuario alemán de la misma base de datos lo verá más adelante como 1,99 y 13.1.2008.</para>
423
<para>Sin embargo, el sistema Glom que crea contiene también texto que debe traducirse si personas que hablan diferentes idiomas lo van a usar.Por ejemplo, puede proporcionar traducciones para los títulos de sus tablas, campos e informes. Todos estos elementos de texto se pueden ver en una lista cuando selecciona <literal>Traducciones</literal> en el menú <literal>Desarrollador</literal>. En esta ventana puede especificar el idioma que ha utilizado para el texto original, e introducir las traducciones adicionales en cada idioma para cada elemento de texto. Cuando un usuario de ese idioma abre el sistema Glom, se mostrarán esos elementos de texto en la interfaz de usuario.</para>
427
425
<!-- TODO: Update this screenshot -->
428
426
<figure id="developer-translations">
429
<title>Translations</title>
427
<title>Traducciones</title>
432
430
<imageobject><imagedata fileref="figures/glom_design_translations.png" format="PNG"/>
435
<phrase>Translations.</phrase>
433
<phrase>Traducciones.</phrase>
441
<para>Experienced translators may be more familiar with the .po file format, or you might wish to use the many tools that work with the .po file format. By using the <literal>Export</literal> button you can create a .po file to use in a separate tool or to send to a translator. You can then import the resulting translation by using the <literal>Import</literal> button.</para>
439
<para>Los traductores experimentados pueden estar más familiarizados con el formato .po, o puede desear utilizar la mayoría de las herramientas que funcionan con el formato .po. Al usar el botón <literal>Exportar</literal> puede crear un archivo .po para utilizarlo en una herramienta aparte o para enviárselo a un traductor. Puede importar la traducción resultante usando el botón <literal>Importar</literal>.</para>
445
443
<sect2 id="defining-reports">
446
<title>Defining Reports</title>
444
<title>Definir informes</title>
448
446
<sect3 id="adding-or-editing-reports">
449
<title>Adding or Editing Reports</title>
447
<title>Añadir o editar informes</title>
451
<para>Glom can produce reports to show specific fields for sets of records, sorted and grouped.
452
For instance, a shop might need a report listing all products sold in one month, grouped by product type, and sorted by price inside each group. Each table has its own reports, which are available to the operator from the <literal>Reports</literal> menu.</para>
453
<para>To define a report, or to change the definition of an existing report, choose <literal>Reports</literal> from the <literal>Developer</literal> menu.</para>
449
<para>Glom puede generar informes para mostrar campos específicos o conjuntos de registros, ordenados y agrupados. Por ejemplo, una tienda puede necesitar un informe que liste todos los productos vendidos en un mes, agrupados por tipo de producto, y ordenados por precio dentro de cada grupo. Cada tabla tiene sus propios informes, que están a disposición del operador en el menú <literal>Informes</literal>.</para>
450
<para>Para definir un informe, o para cambiar la definición de un informe existente, seleccione <literal>Informes</literal> en el menú <literal>Desarrollador</literal>.</para>
454
451
<figure id="developer-editing-reports">
455
<title>Creating or Editing Reports</title>
452
<title>Crear o editar informes</title>
458
455
<imageobject><imagedata fileref="figures/glom_design_reports.png" format="PNG"/>
461
<phrase>Creating or editing reports.</phrase>
458
<phrase>Crear o editar informes.</phrase>
467
<para>Notice that each report has an ID as well as a human-readable name. This allows your report to have a translated title when used on a computer that uses a different language.</para>
464
<para>Tenga en cuenta que cada informe tiene un ID, así como un nombre legible por humanos. Esto permite que su informe tenga un título traducido cuando se utiliza en un ordenador que trabaja con un idioma diferente.</para>
471
468
<sect3 id="editing-a-report">
472
<title>Editing a Report</title>
474
<para>A Glom report has three areas:
476
<listitem><simpara>The Header, which appears at the start of the report</simpara></listitem>
477
<listitem><simpara>The Main area, in which the records and summary lines are shown, with the actual data from the database.</simpara></listitem>
478
<listitem><simpara>The Footer, which appears at the end of the report.</simpara></listitem>
482
<para>Inside an area, such as the Main part, you may add report <literal>Parts</literal>, such as fields, text, or images. These will usually appear in a row on the printed report, with one row for each record. In the simple case, this will look much like Glom's list view. You can add parts to your report by selecting them from the <literal>Available Parts</literal> list and then clicking the <literal>Add</literal> button. The part will then be added to the <literal>Parts</literal> list, in the selected area.</para>
483
<para>To specify details for the parts, such as the text or image to display, or to choose the field to display, select the part in the <literal>Parts</literal> list and click the <literal>Edit</literal> button. You may also specify field formatting by clicking the <literal>Formatting</literal> button, just as you would when defining a details or list layout.</para>
469
<title>Editar un informe</title>
471
<para>Un informe de Glom tiene tres áreas: <orderedlist>
472
<listitem><simpara>La cabecera, que aparecerá al principio del informe</simpara></listitem>
473
<listitem><simpara>El área principal, donde se muestran los registros y las líneas de resumen, con los datos actuales de la base de datos.</simpara></listitem>
474
<listitem><simpara>El pie, que aparecerá al final del informe.</simpara></listitem>
475
</orderedlist></para>
477
<para>Dentro de un área, como la parte principal, puede añadir <literal>Partes</literal> de un informe, tales como campos, texto o imágenes. Habitualmente aparecerán en una fila en el informe impreso, con una fila para cada registro. En el caso simple, se parecerá mucho a la vista de lista de Glom. Puede añadir partes a su informe seleccionándolas de la lista <literal>Partes disponibles</literal> y pulsando en el botón <literal>Añadir</literal>. Se añadirá la parte a la lista <literal>Partes</literal>, en el área seleccionada.</para>
478
<para>Para especificar los detalles de las partes, tales como el texto o la imagen que mostrar, o seleccionar el campo que mostrar, seleccione la parte en la lista <literal>Partes</literal> y pulse el botón <literal>Editar</literal>. También puede especificar el formato del campo pulsando el botón <literal>Formato</literal>, simplemente como lo haría cuando define la disposición de los detalles o la disposición de una lista.</para>
485
480
<figure id="developer-editing-reports-details">
486
<title>Editing a Report</title>
481
<title>Editar un informe</title>
489
484
<imageobject><imagedata fileref="figures/glom_design_reports_details.png" format="PNG"/>
492
<phrase>Editing a report.</phrase>
487
<phrase>Editar un informe.</phrase>
498
<para>Some parts may contain other parts and have extra properties to control how they present their child parts. For instance, the <literal>Group By</literal> part groups records together by a field. For instance, a products report might group a list of products by product type. You can even add a second sub-grouping inside the main <literal>Group By</literal> part, by selecting your top-level <literal>Group By</literal> part in the <literal>Parts</literal> list while adding a new <literal>Group By</literal> part from the <literal>Available Parts</literal> list. For instance, you might group your products by manufacturer, inside each product type group.</para>
499
<para>To specify the field by which the records should be grouped, select your <literal>Group By</literal> part in the <literal>Parts</literal> list and click the <literal>Edit</literal> button. You can then choose the field by which the records should be grouped, and select the fields by which these records should be sorted within the group. You may also specify some additional fields to be displayed in the group's title row. For instance, you might want to group products by a manufacturer ID, but also show the manufacturer name.</para>
493
<para>Algunas partes pueden contener otras partes y tener propiedades adicionales para controlar como se presentan su partes hijas. Por ejemplo, la parte <literal>Agrupar por</literal> agrupa registros juntos por un campo. Por ejemplo, un informe de productos debe agrupar una lista de productos por tipo de producto. También puede añadir una segunda agrupación dentro de la parte <literal>Agrupar por</literal> principal, seleccionando la primera parte <literal>Agrupar por</literal> en la lista <literal>Partes</literal> mientras añade una nueva parte <literal>Agrupar por</literal> de la lista <literal>Partes disponibles</literal>. Por ejemplo, puede agrupar sus productos por fabricante, dentro de cada grupo de tipo de producto.</para>
494
<para>Para especificar el campo por el que se agruparán los registros, seleccione su parte <literal>Agrupar por</literal> en la lista <literal>Partes</literal> y pulse el botón <literal>Editar</literal>. Entonces puede seleccionar el campo por el que quiere que se ordenen los registros, y seleccionar los campos por los que esos registros deberán ordenarse dentro del grupo. También debe especificar algunos campos adicionales para mostrar en el título de la fila del grupo. Por ejemplo, puede querer agrupar productos por ID de fabricante, pero mostrar también el nombre del fabricante.</para>
501
496
<figure id="developer-editing-reports-group_by">
502
<title>Editing a Group By Part</title>
497
<title>Editar un grupo por partes</title>
505
500
<imageobject><imagedata fileref="figures/glom_design_reports_group_by.png" format="PNG"/>
508
<phrase>Editing a report.</phrase>
503
<phrase>Editar un informe.</phrase>
514
<para>The <literal>Vertical Group</literal> part may contain other items. For instance, it allows you to arrange fields below each other instead of just one after the other in the horizontal row. This is useful for grouping related fields such as address lines, or just to squeeze more information into the records's row on the report.</para>
509
<para>La parte <literal>Grupo vertical</literal> puede contener otros elementos. Por ejemplo, le permite ordenar campos junto a otros en lugar de uno detrás de otro en la fila horizontal. Ésto es útil para agrupar campos relacionados tales como direcciones, o simplemente apretar más información dentro de la fila del registro del informe.</para>
516
511
<figure id="developer-editing-reports-vertical_group">
517
<title>A Report with Vertical Groups</title>
512
<title>Un informe con grupos verticales</title>
520
515
<imageobject><imagedata fileref="figures/glom_design_reports_vertical_group.png" format="PNG"/>
523
<phrase>A Report with Vertical Groups.</phrase>
518
<phrase>Un informe con grupos verticales.</phrase>
529
<para>When you have finished, click the <literal>Close</literal> button to save the report's definition. Your report can then be chosen from the <literal>Reports</literal> menu. See the <link linkend="glom-operator-printing-reports">Printing Reports</link> section for more details.</para>
524
<para>Cuando haya acabado, pulse el botón <literal>Cerrar</literal> para guardar la definición del informe. Puede seleccionar su informe desde el menú <literal>Informes</literal>. Para obtener más detalles vea la sección </para>
543
538
<title>Diálogos</title>
545
540
<sect2 id="dialog_existing_or_new">
546
<title>Dialog: Initial dialog</title>
547
<para>This dialog allows the user to choose an existing document or create a new document. Existing documents may be selecting from the list of recently opened documents or by select a file with the file chooser dialog. Documents can also be opened via the network if other users are running Glom on the local network. Finally, a new document can be created either by opening a template file which already contains some initial tables and records, or by creating an empty document.</para>
541
<title>Diálogo: Diálogo inicial</title>
542
<para>Este diálogo permite al usuario seleccionar un documento existente o crear un documento nuevo. Los documentos existentes se deben seleccionar de la lista de documentos abiertos recientemente, o seleccionando un archivo con el diálogo de selección de archivos. También se pueden abrir los documentos a través de la red, si otros usuarios están ejecutando Glom en la red local. Finalmente, se puede crear un documento nuevo abriendo una plantilla que ya contenga algunas tablas o registros iniciales, o creando un documento vacío.</para>
550
545
<sect2 id="dialog_new_database">
551
<title>Dialog: New database</title>
546
<title>Diálogo: Nueva base de datos</title>
555
550
<sect2 id="dialog_error_create_database">
556
<title>Dialog: Create database</title>
551
<title>Diálogo: Crear base de datos</title>
560
555
<sect2 id="dialog_connection">
561
<title>Dialog: Connection</title>
562
<para>This dialog requests a user name and password for connection to a database server. This is usually not the same username and password combination with which you log in to your system. All Glom systems require a database server on which the actual data will be stored. If the database server is not running on your local computer ("localhost"), then you must also provide its network hostname, such as "glomserver.openismus.com", though your hostname will be different.</para>
563
<para>Your system administrator can provide these database login details.</para>
564
<para>If you are the system administrator, see Glom's <ulink url="http://www.glom.org/wiki/index.php?title=Initial_Postgres_Configuration" type="http">Postgres Configuration</ulink> web page for help with installing and configuring a database server.</para>
556
<title>Diálogo: Conexión</title>
557
<para>Este cuadro de diálogo solicita un nombre de usuario y una contraseña para conectar a un servidor de bases de datos. Normalmente no es la misma combinación de usuario y contraseña que utiliza para autenticarse en su sistema. Todos los sistemas Glom requieren un servidor de bases de datos en el que almacenar los datos actuales. Si el servidor de bases de datos no se está ejecutando en el equipo local («localhost»), debe proporcionar el nombre del equipo, tal como "glomserver.openismus.com", aunque su nombre del equipo sea diferente.</para>
558
<para>Su administrador de sistemas puede proporcionarle esos detalles de conexión a la base de datos.</para>
559
<para>Si es el administrador del sistema. lea la página web de Glom <ulink url="http://www.glom.org/wiki/index.php?title=Initial_Postgres_Configuration" type="http">Configuración de Postgres</ulink> para obtener ayuda con la instalación y configuración del servidor de bases de datos.</para>
567
562
<sect2 id="dialog_error_connection">
568
<title>Dialog: Connection Error</title>
569
<para>This dialog is shown when Glom could not connect to the specified database server. Either the database server is not running at the specified hostname, or the user name and password were not accepted by the database server. See the <link linkend="dialog_connection">Connection Dialog</link> section for more details.</para>
563
<title>Diálogo: Error de conexión</title>
564
<para>Este diálogo se muestra cuando Glom no puede conectar con el servidor de bases de datos especificado. O el servidor de bases de datos no está funcionando en el equipo especificado, o el servidor de bases de datos no aceptó el nombre de usuario y la contraseña. Para obtener más detalles consulte la sección <link linkend="dialog_connection">Diálogo de conexión</link>.</para>
574
569
<sect2 id="dialog_database_preferences">
575
<title>Dialog: Database preferences</title>
570
<title>Diálogo: Preferencias de la base de datos</title>
579
574
<sect2 id="dialog_change_language">
580
<title>Dialog: Change language</title>
575
<title>Diálogo: Cambiar idioma</title>
584
579
<sect2 id="window_textobject">
585
<title>Window: Textobject</title>
580
<title>Ventana: Objeto de texto</title>
589
584
<sect2 id="window_imageobject">
590
<title>Window: Imageobject</title>
585
<title>Ventana: Objeto de imagen</title>
594
589
<sect2 id="dialog_notebook">
595
<title>Dialog: Notebook</title>
590
<title>Diálogo: Cuaderno de notas</title>
599
594
<sect2 id="dialog_data_invalid_format">
600
<title>Dialog: Data invalid format</title>
595
<title>Diálogo: Formato de datos inválido</title>
604
599
<sect2 id="dialog_relationship_overview">
605
<title>Dialog: Relationship overview</title>
600
<title>Diálogo: Descripción de la relación</title>
609
604
<sect2 id="window_groups">
610
<title>Window: Groups</title>
605
<title>Ventana: Grupos</title>
614
609
<sect2 id="dialog_groupby_sort_fields">
615
<title>Dialog: Group by sort fields</title>
610
<title>Diálogo: Agrupar por campos ordenados</title>
619
614
<sect2 id="dialog_groupby_secondary_fields">
620
<title>Dialog: Group by secondary fields</title>
615
<title>Diálogo: Agrupar por campos secundarios</title>
624
619
<sect2 id="window_button_script">
625
<title>Window: Button script</title>
620
<title>Ventana: Botón de script</title>
629
624
<sect2 id="window_field_calculation">
630
<title>Window: Field calculation</title>
625
<title>Ventana: Cálculo de campos</title>
634
629
<sect2 id="dialog_new_group">
635
<title>Dialog: New group</title>
630
<title>Diálogo: Grupo nuevo</title>
639
634
<sect2 id="dialog_choose_user">
640
<title>Dialog: Choose user</title>
635
<title>Diálogo: Elegir usuario</title>
644
639
<sect2 id="dialog_user">
645
<title>Dialog: User</title>
640
<title>Diálogo: Usuario</title>
649
644
<sect2 id="dialog_translation_identify_original">
650
<title>Dialog: Translation identify original</title>
645
<title>Diálogo: La traducción identifica al original</title>
654
649
<sect2 id="dialog_translation_copy">
655
<title>Dialog: Translation copy</title>
650
<title>Diálogo: Copia de la traducción</title>
659
654
<sect2 id="dialog_choose_date">
660
<title>Dialog: Choose Date</title>
655
<title>Diálogo: Elegir fecha</title>
659
<sect2 id="dialog_import_csv">
660
<title>Diálogo: Importar a una tabla</title>
661
<para>Este diálogo permite al usuario importar un archivo CSV (valores separados por comas) en la tabla de la base de datos actual. Muestra las primeras filas del archivo para importar y permite al usuario seleccionar el campo destino en la base de datos para cada columna del archivo CSV. Para autoincrementar las claves primarias, el campo de la clave primaria no se puede utilizar como campo destino, de lo contrario se debe importar una columna en el campo de la clave primaria.</para>
666
666
<!-- ============= Bugs ================================== -->
704
704
<appendix id="sec-calculated-fields">
705
<title>Calculated fields and button scripts</title>
706
<para>Calculated fields and button scripts use the Python programming language. The calculation or script is the implementation of a function whose signature is provided for you.</para>
705
<title>Campos calculados y botones de script</title>
706
<para>Los campos calculados y los botones de scripts usan el lenguaje de programación Python.El cálculo o el script es la implementación de una función cuya firma se le proporciona.</para>
708
708
<figure id="developer-editing-fields-calculated">
709
<title>Editing the definition of a calculated field</title>
709
<title>Editar la definición de un campo calculado</title>
712
712
<imageobject><imagedata fileref="figures/glom_design_fields_dialog_calculated.png" format="PNG"/>
715
<phrase>Editing the definition of a calculated field.</phrase>
715
<phrase>Editar la definición de un campo calculado.</phrase>
721
721
<sect1 id="field-values">
722
<title>Field values</title>
723
<para>For instance, <programlisting>record["name_first"]</programlisting> is the value of the name_first field in the current record.</para>
722
<title>Valores de campo</title>
723
<para>Por ejemplo, <programlisting>record["name_first"]</programlisting> es el valor del campo name_first en el registro actual.</para>
726
726
<sect1 id="related-records">
727
<title>Related Records</title>
728
<para>For instance, <programlisting>record.related["location"]</programlisting> provides the related records for the current record.</para>
727
<title>Registros relacionados</title>
728
<para>Por ejemplo, <programlisting>record.related["ubicación"]</programlisting> proporciona los registros relacionados con el registro actual.</para>
730
730
<sect2 id="single-related-records">
731
<title>Single related records</title>
732
<para>For relationships that specify a single record, you can get the value of a field in that record. For instance, <programlisting>record.related["location"]["name"]</programlisting> is the value of the name field in the table indicated by the location relationship (often called location::name).</para>
731
<title>Un sólo registro relacionado</title>
732
<para>Para relaciones que especifican un único registro puede obtener el valor de un campo en ese registro. Por ejemplo, <programlisting>record.related["ubicación"]["nombre"]</programlisting> es el valor del nombre del campo en la tabla indicada por la relación de ubicación (habitualmente denominada ubicación::nombre).</para>
735
735
<sect2 id="multiple-related-records">
736
<title>Multiple related records</title>
737
<para>For relationships that specify multiple records, you can use the aggregate functions (sum, count, average) to get overall values. For instance, <programlisting>record.related["invoice_lines"].sum("total_price")</programlisting>.</para>
736
<title>Múltiples registros relacionados</title>
737
<para>Para relaciones que especifican múltiples registros, puede utilizar las funciones de adición (sum, count, average) para obtener todos los valores. Por ejemplo, <programlisting>record.related["lineas_de_factura"].sum("precio_total")</programlisting>.</para>
742
742
<sect1 id="testing-for-empty-values">
743
<title>Testing for empty values</title>
745
How you test for empty values depends on the type of field:
743
<title>Probando para valores vacíos</title>
744
<para>La manera de probar para valores vacíos depende del tipo de campo:</para>
748
746
<sect2 id="non-text-fields">
749
<title>Non-text fields</title>
750
<para>Non-text fields may be empty, indicating that the user has not entered any value in the field. For instance, Glom does not assume that an empty value in a numeric field should mean 0.</para>
751
<para>You can test whether a field is empty by using Python's None. For instance:</para>
747
<title>Campos que no son de texto</title>
748
<para>Los campos que no sean de texto deben estar vacíos, indicando que el usuario no ha introducido ningún valor en el campo. Por ejemplo, Glom no asume que un valor vacío en un campo numérico deba valer 0.</para>
749
<para>Puede probar si un campo está vacío usando el código Python «None». Por ejemplo:</para>
754
752
if(record["contact_id"] == None):
753
return "Sin contacto"
757
755
return record.related["contacts"]["name_full"]
758
756
</programlisting>
760
<para>You might also test whether there are any related records. For instance:</para>
758
<para>También puede comprobar si hay algunos registros relacionados. Por ejemplo:</para>
763
761
if(record.related["contacts"] == None):
762
return "Sin contacto"
766
764
return record.related["contacts"]["name_full"]
767
765
</programlisting>
786
784
<sect1 id="using-the-full-pygda-api">
787
<title>Using the full pygda API</title>
788
<para>pygda is a python API for the libgda API. The record's <literal>connection</literal> attribute provides a gda.connection that can be used to access the current database directly. This allows you to run any SQL query, for instance to read data from the database with a SELECT, or to change values in the database with an UPDATE. Note that the connection is already open so you can avoid the difficult work of specifying the connection details.</para>
789
<para>The record's <literal>table_name</literal> attribute also provides the name of the current table.</para>
790
<para>(Note that the <literal>record.connection</literal> and <literal>record.table_name</literal> attributes are only available since Glom 1.1.6.)</para>
791
<para>This example reads all data from the current table and prints the values to the terminal: </para>
785
<title>Usando la API pydga completa</title>
786
<para>pygda es una API de Python para la API libgda. Los atributos de los registros <literal>connection</literal> proporcionan una conexión gda que puede usarse para acceder directamente a la base de datos actual. Esto le permite ejecutar cualquier consulta SQL, por ejemplo para leer datos de la base de datos con un SELECT o cambiar valores en la base de datos con un UPDATE. Nótese que la conexión ya está abierta, por lo que puede evitar el difícil trabajo de especificar los detalles de la conexión.</para>
787
<para>El atributo del registro <literal>table_name</literal> también proporciona el nombre de la tabla actual.</para>
788
<para>(Nótese que los atributos <literal>record.connection</literal> y <literal>record.table_name</literal> sólo están disponibles desde la versión 1.1.6 de Glom.)</para>
789
<para>Este ejemplo lee todos los datos de la tabla actual e imprime los valores en la terminal:</para>
794
# Use the current database's connection
795
# to get all the data for the current table.
792
# Usa la conexión actual a la base de datos
793
# para obtener todos los datos de la tabla actual.
797
# record.connection is an already-open gda.connection object,
798
# saving us the bother of opening the connection,
799
# or even knowing the name of the database.
795
# la conexión de registros es un objeto gda.connection ya abierto,
796
# evitando la incomodidad de abrir la conexión,
797
# o incluso conociendo el nombre de la base de datos.
801
799
query = "SELECT * FROM %s" % record.table_name
802
800
command = gda.Command(query)