From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Spreadsheet FR Date: Fri, 02 Apr 2010 10:26:20 -0400 Message-ID: <877hoqrkvn.fsf@fastmail.fm> References: <20100401214648.GL7262@thinkpad.adamsinfoserv.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nxhoi-0004S9-PR for emacs-orgmode@gnu.org; Fri, 02 Apr 2010 10:25:48 -0400 Received: from [140.186.70.92] (port=58896 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nxhoe-0004R5-QV for emacs-orgmode@gnu.org; Fri, 02 Apr 2010 10:25:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nxhod-0000NJ-5G for emacs-orgmode@gnu.org; Fri, 02 Apr 2010 10:25:44 -0400 Received: from out3.smtp.messagingengine.com ([66.111.4.27]:33550) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nxhod-0000N8-2e for emacs-orgmode@gnu.org; Fri, 02 Apr 2010 10:25:43 -0400 Received: from archdesk (adsl-99-181-139-122.dsl.klmzmi.sbcglobal.net [99.181.139.122]) by mail.messagingengine.com (Postfix) with ESMTPSA id DE2594D3D9A for ; Fri, 2 Apr 2010 10:25:41 -0400 (EDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode Hi Russell, Russell Adams 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