Org-mode mailing list
 help / color / mirror / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Axel Kielhorn <org-mode@axelkielhorn.de>
Cc: Org-Mode Mailing List <emacs-orgmode@gnu.org>
Subject: Re: Two tables with same data but different sorting
Date: Thu, 1 Oct 2020 08:21:20 -0400
Message-ID: <CAJ51ETqY-R0Udw=qr2fpUYDt80EjD63HSSgFFsTkj+gmcLwQ9A@mail.gmail.com> (raw)
In-Reply-To: <65644810-71B5-412C-9E13-ADC15CA80CF6@axelkielhorn.de>

[-- Attachment #1: Type: text/plain, Size: 1797 bytes --]

You could do something like this:


* Table 1

#+name: table1
| Manufacturer    | Name        | Price |
|-----------------+-------------+-------|
| ACME            | super cheep | 25 $  |
| Roadrunner Inc. | Kaboom      | 27 $  |
| ACME            | cheep       | 30 $  |

#+RESULTS: resorted
| Manufacturer    | Name        | Price |
|-----------------+-------------+-------|
| ACME            | super cheep | 25 $  |
| ACME            | cheep       | 30 $  |
| Roadrunner Inc. | Kaboom      | 27 $  |

** Code for resorting

#+name: resorted
#+BEGIN_SRC emacs-lisp :var data=table1 :colnames t
(sort data (lambda (row1 row2) (string< (first row1) (first row2))))
#+END_SRC

John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Thu, Oct 1, 2020 at 4:57 AM Axel Kielhorn <org-mode@axelkielhorn.de>
wrote:

> Hello!
>
> I have a table that I want to show with two different sorting orders but I
> don’t want to maintain the data twice.
>
>
> * Table 1
>
> | Manufacturer    | Name        | Price |
> |-----------------+-------------+-------|
> | ACME            | super cheep | 25 $  |
> | Roadrunner Inc. | Kaboom      | 27 $  |
> | ACME            | cheep       | 30 $  |
>
> *  Table 2
>
> | Manufacturer    | Name        | Price |
> |-----------------+-------------+-------|
> | ACME            | cheep       | 30 $  |
> | ACME            | super cheep | 25 $  |
> | Roadrunner Inc. | Kaboom      | 27 $  |
>
> Is there a way to do this in org?
> Right now I copy the table and apply an =C-c ^ a= on the first column.
>
> Greetings
> Axel
>

[-- Attachment #2: Type: text/html, Size: 2567 bytes --]

  reply	other threads:[~2020-10-01 12:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  8:55 Axel Kielhorn
2020-10-01 12:21 ` John Kitchin [this message]
2020-10-01 14:36   ` Axel Kielhorn
2020-10-01 15:47     ` John Kitchin
2020-10-02  6:25       ` Axel Kielhorn
2020-10-02  9:36         ` Robert Pluim
2020-10-05  8:08           ` Axel Kielhorn
2020-10-05  8:32             ` Robert Pluim
2020-10-05  9:21               ` Axel Kielhorn
2020-10-05  9:45                 ` Robert Pluim
2020-10-02 21:04         ` John Kitchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ51ETqY-R0Udw=qr2fpUYDt80EjD63HSSgFFsTkj+gmcLwQ9A@mail.gmail.com' \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=org-mode@axelkielhorn.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git