From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uMO8IcpczmEQbAAAgWs5BA (envelope-from ) for ; Fri, 31 Dec 2021 02:28:42 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id IKQIH8pczmH73wAA9RJhRA (envelope-from ) for ; Fri, 31 Dec 2021 02:28:42 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 38E71BE32 for ; Fri, 31 Dec 2021 02:28:42 +0100 (CET) Received: from localhost ([::1]:47640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n36in-0005Xt-9R for larch@yhetil.org; Thu, 30 Dec 2021 20:28:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n36aW-0008Ow-Gz for emacs-orgmode@gnu.org; Thu, 30 Dec 2021 20:20:12 -0500 Received: from [2607:f8b0:4864:20::531] (port=39742 helo=mail-pg1-x531.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n36aU-0000FG-63 for emacs-orgmode@gnu.org; Thu, 30 Dec 2021 20:20:07 -0500 Received: by mail-pg1-x531.google.com with SMTP id r5so22672061pgi.6 for ; Thu, 30 Dec 2021 17:20:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version:content-transfer-encoding; bh=FPSYYd3P6QOg5twD3Q0ouZMeeel063PT3197GqZaJec=; b=RUdrOTzChFagpPtKwyp1hM1yY9wVeNQuUtPrQyJ/97TsNgmWnXsB4QeTh94IpHr9sk IYnRTK3MDnyZwny+ABN/oSpiFLwIlv14ZS2JoCzhzn+DnbCivskLSmO10OISe6mVvDmb ARIX7ua3RDwTJE/pbngGSkV52XwWMUtv+tt9LzCEvIe2Va00yKB/Aq4Yo1c9xSqlG5LX W2dR8MDZZnFRQiq1yZtGUWp/LrZrj6Iievtg9NckxDgrFtL3GVHNo0kix2sLpa/vR2Ez cvsE9Ll2fSZrSYIwb9ChNyUXRfkncBev7rfSiztuoND+A6cZdzpFe/0rJZfkS/GsJzJV FNJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version:content-transfer-encoding; bh=FPSYYd3P6QOg5twD3Q0ouZMeeel063PT3197GqZaJec=; b=sXq4Dz0h0OlxmNCf2hXhgKgIxdzPZtFM2SXkhgLTH4tJ4KLLVTHxOYEP+O4cDHUN+N I9d1Eb1690vJUvLkwKosxVl0wq4/SAv2+u4sPn4ntxGB8kSegUrYNfHZfHySyo0P6h3V acRq3PfwsEIzcnJ4lXf6RMsqacROXqwHV9d3X4gnLrOQGk61c75GueLrb+f+ddtBpOjr ChCUGzAoJ3alGY1jHQQE2n1hViujET5nvMaI1UlLJV3T+BjSymG3PizIfipBWdh/4viu 9s1anOWlwZSRYw5myrm0mIZgEQ9XUgf/NhOcYPgrsNTPKDv5L0qeeVD39qHC+sWU0U+r 6kNA== X-Gm-Message-State: AOAM532Cy0kdPcnbhU9i1MJjR5nB2qYVqsODSDL8rrjmqCwvX1jbz2Hs DnmScmAMCPSSY/zRHymINxFwzxFAPgI= X-Google-Smtp-Source: ABdhPJymV4yGnmVtJdo+k7AMhna856GmsV3bj9JZ1xWXWzQgNfUvXqt04eNq7w2N2Fk4bfiz1M1ojQ== X-Received: by 2002:a62:b503:0:b0:4bc:657e:cfa6 with SMTP id y3-20020a62b503000000b004bc657ecfa6mr3735419pfe.25.1640913602950; Thu, 30 Dec 2021 17:20:02 -0800 (PST) Received: from dingbat ([124.149.107.194]) by smtp.gmail.com with ESMTPSA id i4sm12257010pjj.30.2021.12.30.17.20.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Dec 2021 17:20:02 -0800 (PST) References: <871r1tc0cm.fsf@mat.ucm.es> User-agent: mu4e 1.7.5; emacs 28.0.90 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: org table problems with sorting of some column Date: Fri, 31 Dec 2021 12:00:19 +1100 In-reply-to: <871r1tc0cm.fsf@mat.ucm.es> Message-ID: <87czld4lkw.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::531 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=theophilusx@gmail.com; helo=mail-pg1-x531.google.com X-Spam_score_int: 6 X-Spam_score: 0.6 X-Spam_bar: / X-Spam_report: (0.6 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640914122; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=FPSYYd3P6QOg5twD3Q0ouZMeeel063PT3197GqZaJec=; b=sNh4RSqvl1pOI1X6eGQcaIFxJ7WwuOe41qUJ2YCPXz+KHIGGvyPrJoN6/mjMxr82sXRWkd cis0FAy+D857FbJm1NAXUskHC7e5zHmDfvxNXHmp5mPFXUIu1QaIyQnym1grEd6dQxvrSk rbvIFf7LYWFFQVzULLezgMyJKDjHJxhcvztyDLjdC/Ja57CNCQrYtYRz7DPBiKoMGw631V 5aRT5onB2r8HFA7m0dMikoCYLYi4unngmdUkTSf0egSnRgEifgawlqq9NjEaaamNB+VaMi kXeVDxPCJcghGo9tOF+36FdgaMK29ZNCAdBm3+m8w+MLXMc4/+tkZ7TOCPVcaQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640914122; a=rsa-sha256; cv=none; b=PoirISGQQ05Bx2aPGuzrOn+UO4mhxV/VfINpAMD7GeMaIgmB1zO/FfKJ2ayj6kZRs8ONqa o4vv4HnyjQesyCbJT6kjarI/F2E6HtE7uNiEqOjN3T2d7i0i8QuhJ4fbngIIwzsARNRjGd WzJmBnTmZP4uuOi+8FI0wMlZ06/DvIocSKVOKGONrPesYbeWlI/N1eVGp/15V9S2YvllIl bjh1xfHkaULvufG5p8ATZLTenHLZZEIj88Jv5YGBxjGSKQ60BUge01Hk6dAW7ttSogDnJn 6GDB8S19gR2msU1FPFRd1cQVSqfAvv4fufmkayUzW+eJnp1lRp7rwYLZg6uB7g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RUdrOTzC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -4.27 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=RUdrOTzC; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 38E71BE32 X-Spam-Score: -4.27 X-Migadu-Scanner: scn1.migadu.com X-TUID: PCyd6T34mYZT Uwe Brauer writes: > [[S/MIME Signed Part:Undecided]] > > > * Problem 1 > > I imported this column from a CVS file, so the date format was already ch= osen. >=20=20 > | Date | > |------------| > | 05.05.2020 | > | 07.01.2021 | > | 07.01.2021 | > | 07.05.2020 | > | 09.03.2021 | > | 12.05.2020 | > | 13.02.2020 | > | 13.03.2020 | > | 13.03.2020 | > | 14.05.2020 | > | 15.02.2021 | > | 15.02.2021 | > | 17.02.2020 | > | 17.04.2020 | > | 20.04.2020 | > | 22.04.2020 | > | 23.06.2020 | > | 24.02.2021 | > | 24.04.2020 | > | 25.09.2020 | > | 25.11.2020 | > > I'd like to sort these dates, but when I do that numerically it does not = work as expected, any idea what to do. > > > * Problem 2 > I'd like to order the column below descending=20 > > | Income | > |----------| > | 837.00 | > | 681.71 | > | 664.16 | > | 499.46 | > | 316.64 | > | 258.30 | > | 258.30 | > | 258.30 | > | 187.52 | > | 173.15 | > | 170.87 | > | 163.50 | > | 127.76 | > | 117.00 | > | 94.80 | > | 91.00 | > | 2.852.21 | > | 2.401.74 | > | 1.912.16 | > | 1.735.14 | > | 1.480.87 | > | 1.407.73 | > > But again it does not work. > > Any idea what to do? > > regards > > Uwe Brauer=20 > > [[End of S/MIME Signed Part]] When reporting a problem, it would really help if you made it clear what you have tried and how it didn't work. From your description above, it is impossible to know if you actually tried using the built-in table sorting command and if you did, how you used it (what input, how you tried calling it etc). You also don't provide any details on what did not work - was it an error, was the sorting wrong, did nothing happen at all? There is also no details regarding your Emacs version or the org version you are running.=20 For problem 1, I suspect you will need to either change the date format or tell org what the date format is. It won't work trying to sort numerically as those values are not really numerical values. The date format you currently have I think is ambiguous - in Europe it would represent dd-mm-yyyy, but in the US it would represent mm-dd-yyyy. Best solution would be to convert the values into an ISO format i.e. yyyy-mm-dd. For problem 2, I suspect the issue is because all your values are not numerical. The value 2.852.21 might be composed of numbers, but that is not a numerical value (what is the value of 1 + 2.852.21?). Org will interpret those values as strings and will sort them alphabetically. The table sorting command in the manual states =E2=80=98C-c ^=E2=80=99 (=E2=80=98org-table-sort-lines=E2=80=99) Sort the table lines in the region. The position of point indicates the column to be used for sorting, and the range of lines is the range between the nearest horizontal separator lines, or the entire table. If point is before the first column, you are prompted for the sorting column. If there is an active region, the mark specifies the first line and the sorting column, while point should be in the last line to be included into the sorting. The command prompts for the sorting type, alphabetically, numerically, or by time. You can sort in normal or reverse order. You can also supply your own key extraction and comparison functions. When called with a prefix argument, alphabetic sorting is case-sensitive. Note the part on providing key extraction and comparison functions. If you cannot convert your data to data formats org is able to recognise, then you will need to provide functions to provide the key comparison logic i.e. how to sort 2.99 and 2.852.21 etc.