emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org table problems with sorting of some column


From: Uwe Brauer
Subject: Re: org table problems with sorting of some column
Date: Fri, 31 Dec 2021 09:20:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

>>> "TC" == Tim Cross <theophilusx@gmail.com> writes:

> Uwe Brauer <oub@mat.ucm.es> writes:

>> [[S/MIME Signed Part:Undecided]]
>> 
>> 
>> * Problem 1
>> 
>> I imported this column from a CVS file, so the date format was already 
>> chosen.
>> 
>> |       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 
>> 
>> |   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 
>> 
>> [[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. 


Point taken. I am using 
GNU Emacs master 846ff294206c922da
org master commit e2fa3c4c4046b

> 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.


It is a European format: dd.mm.yyyy 

So the most convenient way would be to tell org to use that format,
since changing the format to iso, would require to use a sophisticated
reg-expression.

I had a quick look but I cannot find a way to tell org to use the
European dd.mm.yyyy  format.




> 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.

Right, sorry 

| 2.852.21 |
| 2.401.74 |
| 1.912.16 |
| 1.735.14 |
| 1.480.87 |
| 1.407.73 |

Does not make much sense, I replace it by 

| 2852.21 |
| 2401.74 |
| 1912.16 |
| 1735.14 |
| 1480.87 |
| 1407.73 |

And everything worked as expected.

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]