From: Matt Lundin <mdl@imapmail.org>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Spreadsheet FR
Date: Fri, 02 Apr 2010 10:26:20 -0400 [thread overview]
Message-ID: <877hoqrkvn.fsf@fastmail.fm> (raw)
In-Reply-To: 20100401214648.GL7262@thinkpad.adamsinfoserv.com
Hi Russell,
Russell Adams <rladams@adamsinfoserv.com> writes:
> I adore the text spreadsheet, however there's one feature Excel
> provides which I don't have in org.
>
> I often use Excel for "lists", where I can sort or narrow the data by
> specific criteria from a larger list.
>
> Would it be feasible to "narrow" a table by criteria on a specific
> field in between separators? Ie: only display those cells in field A
> if they are > 2, or if field B matches "Pick Me!".
One way to achieve this behavior is by using properties + Eric Schulte's
org-collector.el in contrib. You can enter the data in a subtree using
properties and columns and then capture a subset of that data in a table
using a dynamic block. E.g., given the following subtree...
--8<---------------cut here---------------start------------->8---
* My shopping list
:PROPERTIES:
:COLUMNS: %40ITEM %10AMOUNT %10TYPE
:ID: 41101c80-85b9-4af6-8138-8ad460a2949e
:END:
** Bananas
:PROPERTIES:
:AMOUNT: 2.65
:TYPE: fruit
:END:
** Cheese
:PROPERTIES:
:AMOUNT: 4.54
:TYPE: dairy
:END:
** Flour
:PROPERTIES:
:AMOUNT: 3.00
:TYPE: grain
:END:
** Dish soap
:PROPERTIES:
:AMOUNT: 1.29
:TYPE: kitchen
:END:
** Lettuce
:PROPERTIES:
:AMOUNT: 1.80
:TYPE: vegetable
:END:
** Carrots
:PROPERTIES:
:AMOUNT: 2.56
:TYPE: vegetable
:END:
** Milk
:PROPERTIES:
:AMOUNT: 3.25
:TYPE: dairy
:END:
--8<---------------cut here---------------end--------------->8---
...you can use org-collector to capture a subset of data as follows...
--8<---------------cut here---------------start------------->8---
* Data
#+begin: propview :id "41101c80-85b9-4af6-8138-8ad460a2949e" :conds ((string= TYPE "vegetable")) :cols (ITEM AMOUNT TYPE)
| "ITEM" | "AMOUNT" | "TYPE" |
|-----------+----------+-------------|
| "Lettuce" | 1.8 | "vegetable" |
| "Carrots" | 2.56 | "vegetable" |
|-----------+----------+-------------|
| | 4.36 | |
#+TBLFM: $LR2=vsum(@I+1..@II-1)
#+end
--8<---------------cut here---------------end--------------->8---
Change the conditions to match dairy items greater than 4 and you get
the following:
--8<---------------cut here---------------start------------->8---
* Data
#+begin: propview :id "41101c80-85b9-4af6-8138-8ad460a2949e" :conds ((and (string= TYPE "dairy") (> AMOUNT 4))) :cols (ITEM AMOUNT TYPE)
| "ITEM" | "AMOUNT" | "TYPE" |
|----------+----------+---------|
| "Cheese" | 4.54 | "dairy" |
|----------+----------+---------|
| | 4.54 | |
#+TBLFM: $LR2=vsum(@I+1..@II-1)
#+end
--8<---------------cut here---------------end--------------->8---
Best,
Matt
prev parent reply other threads:[~2010-04-02 14:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 21:46 Spreadsheet FR Russell Adams
2010-04-02 7:49 ` Carsten Dominik
2010-04-02 8:16 ` Russell Adams
2010-04-02 13:00 ` Darlan Cavalcante Moreira
2010-04-04 7:01 ` Carsten Dominik
2010-04-04 16:46 ` Xiao-Yong Jin
2010-04-04 20:19 ` Russell Adams
2010-04-05 2:39 ` Xiao-Yong Jin
2010-04-02 14:44 ` Dan Davison
2010-04-02 14:55 ` Russell Adams
2010-04-02 17:09 ` Russell Adams
2010-04-02 20:43 ` Matt Lundin
2010-04-02 14:26 ` Matt Lundin [this message]
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://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877hoqrkvn.fsf@fastmail.fm \
--to=mdl@imapmail.org \
--cc=emacs-orgmode@gnu.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).