Hola.
Creo que existe un error en la forma en que LibreOffice Calc ordena los datos de un “Intervalo de Base de Datos” mediante los iconos “Orden ascendente” y “Orden descendente”. Actualmente utilizo la versión 25.2 de LibreOffice tanto en Windows como en varias distros de Linux y el problema se repite en todos ellos.
Un “Intervalo de Base de Datos” no es más que un rango de la hoja de cálculo que actúa como una tabla de una base de datos (por ejemplo, una tabla de BD llamada “tblAlumnos” que tuviese los campos Nombre, Apellidos y DNI). En una hoja de cálculo, estos campos estarían en la primera fila (cada uno en una columna) y a partir de la segunda fila estarían los registros de la tabla de la hoja de cálculo, es decir, los nombres y apellidos de los alumnos con el DNI).
Es en estos casos en los que cobran sentido los botones de “Orden ascendente” y “Orden descendente”, ya que los otros dos botones (“Ordenar” y “Filtro automático…”) incluyen sus propias opciones para elegir cómo queremos ver los datos ordenados, de manera ascendente o descendente.
Si alguien ha usado MS Office (yo lo hice durante mucho tiempo), es bastante rápido porque solamente hay que pulsar el icono “Tabla” desde el menú “Insertar” (Insertar > Tabla). Nos pide que señalemos el rango y marcamos la opción “Primera fila tiene encabezados” (siempre que en el rango señalado incluyamos los encabezados, de lo contrario no es necesario marcarlo). Al hacerlo, tendremos una tabla de base de datos y ya podemos utilizar los botones de orden ascendente o descendente para ordenar los datos situando el cursor en la columna (campo) por la que queremos ordenar. Tanto si incluimos los encabezados en el intervalo (marcando la opción correspondiente) como si los dejamos fuera (no marcamos la opción de encabezados incluidos), funciona correctamente la ordenación porque lo tiene en cuenta y éstos no se incluyen dentro de los registros a ordenar.
En LibreOffice, para poder utilizar un rango de la hoja de cálculo como una tabla de una base de datos, es un poco más complicado (no existe ese botón y por tanto hay que hacerlo manualmente). Primero hay que definir el rango desde el menú (Datos > Definir intervalo…). Tenemos que darle un nombre al rango y seleccionarlo. Después tenemos dos opciones: 1) Incluir los encabezados dentro del rango (empezando en la primera fila, que contiene los encabezados), en cuyo caso tendríamos que marcar la opción “Contiene etiquetas de columnas” y 2) No incluir los encabezados dentro del rango (empezando por la segunda fila, que contiene el primer registro correspondiente a un alumno) y por tanto dejaríamos la opción anterior sin marcar. Cuando hayamos decidido, pulsamos “Añadir” para que se registre el rango.
Cuando queramos ordenar el rango, vamos a " Datos > Seleccionar intervalo " y elegimos el que queramos (podemos definir todos los rangos que queramos con su correspondiente nombre).
Y en la opción 1) es donde está el problema. Aunque marquemos la opción “Contiene etiquetas de columna”, no lo tiene en cuenta e incluye la fila con los encabezados como si fuese un registro más y por tanto entran también en la ordenación, por lo que los encabezados pueden aparecer entre los registros de los alumnos.
No sé si me he explicado correctamente. Me gustaría notificarlo porque creo que es un error importante (aunque hay más formas de hacer que salga correctamente si se sabe del problema, por ejemplo no usando los dos botones implicados, aunque creo que en ese caso sería mejor desactivarlos de la barra), pero mi nivel de inglés no es demasiado bueno para poder explicar todo esto (y las traducciones son horrorosas). Si alguien quiere comprobar lo que he explicado, y quiere notificar el error, pues agradecido. Además del inglés, tampoco sabría cómo hacerlo.
Un saludo
Hello.
I think there is a bug in the way LibreOffice Calc sorts the data in a “Database Interval” using the “Ascending Order” and “Descending Order” icons. I currently use LibreOffice version 25.2 on both Windows and various Linux distros and the problem recurs on all of them.
A “Database Range” is nothing more than a spreadsheet range that acts like a table in a database (for example, a DB table called “tblStudents” that would have the fields FirstName, LastName and ID). In a spreadsheet, these fields would be in the first row (each one in a column) and from the second row onwards would be the records of the spreadsheet table, i.e. the first and last names of the students with the ID).
It is in these cases that the “Ascending order” and “Descending order” buttons make sense, since the other two buttons (“Sort” and “Automatic filter…”) include their own options to choose how we want to see the data sorted, ascending or descending.
If anyone has used MS Office (I did for a long time), it is quite fast because you only have to click on the “Table” icon from the “Insert” menu (Insert > Table). It asks us to point out the range and we check the option “First row has headers” (provided that in the pointed out range we include the headers, otherwise it is not necessary to check it). By doing so, we will have a database table and we can now use the ascending or descending order buttons to sort the data by placing the cursor in the column (field) by which we want to sort. Whether we include the headers in the range (by checking the corresponding option) or leave them out (do not check the option of headers included), the sorting works correctly because it takes it into account and they are not included in the records to be sorted.
In LibreOffice, to be able to use a spreadsheet range as a database table, it is a bit more complicated (there is no such button and therefore you have to do it manually). First we have to define the range from the menu (Data > Define range…). We have to name the range and select it. Then we have two options: 1) Include the headers within the range (starting from the first row, which contains the headers), in which case we would have to check the option “Contains column labels” and 2) Do not include the headers within the range (starting from the second row, which contains the first record corresponding to a student) and therefore we would leave the previous option unchecked. When we have decided, we click “Add” to register the range.
When we want to sort the range, we go to “Data > Select range” and choose the one we want (we can define as many ranges as we want with their corresponding name).
And option 1) is where the problem lies. Even if we check the option “Contains column labels”, it does not take it into account and includes the row with the headers as if it were another record and therefore they also enter in the sorting, so the headers may appear among the student records.
I don’t know if I have explained myself correctly. I would like to report it because I think it is a major bug (although there are more ways to make it come out correctly if you know about the problem, for example not using the two buttons involved, although I think in that case it would be better to disable them from the bar), but my English level is not too good to be able to explain all this (and the translations are horrendous). If someone wants to check what I have explained, and wants to notify the error, then thank you. Besides English, I wouldn’t know how to do it either.
Best regards