From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uwe Brauer Subject: Re: extract a region from a table and export it Date: Tue, 14 Jun 2016 12:13:11 +0000 Message-ID: <87h9cwvui0.fsf@mat.ucm.es> References: <87oa74vyma.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCnH4-0002Xw-OX for emacs-orgmode@gnu.org; Tue, 14 Jun 2016 08:16:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCnH0-0002nR-HH for emacs-orgmode@gnu.org; Tue, 14 Jun 2016 08:16:53 -0400 Received: from plane.gmane.org ([80.91.229.3]:58269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCnH0-0002nH-9d for emacs-orgmode@gnu.org; Tue, 14 Jun 2016 08:16:50 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bCnFW-0000ZX-CD for emacs-orgmode@gnu.org; Tue, 14 Jun 2016 14:15:18 +0200 Received: from gilgamesch.quim.ucm.es ([147.96.12.99]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jun 2016 14:15:18 +0200 Received: from oub by gilgamesch.quim.ucm.es with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Jun 2016 14:15:18 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org >>> "John" == John Kitchin writes: Hi John, > can you write a little code block that filters the table for what you > want, and then convert that to a pdf? Great! Thanks a lot. This is a brilliant idea, on a second thought I would even say that I don't need orgtbl-to-csv, but I just want to extract 3 columns of a table which contains 10. What would the relevant syntax be for column, please? This way I have a poor-man's database (basically I need that for the grades of my students). > Something like: > #+tblname: data > | 1 | a | > | 2 | r | > | 5 | 7 | > | 4 | 9 | > | 8 | y | > #+BEGIN_SRC emacs-lisp :var d=data > (orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (< (car x) 8))) d) nil) > #+END_SRC I obtain an error when I run your code (but of them, namely) (but I am using a very recent version of org mode) ,---- | | Debugger entered--Lisp error: (wrong-type-argument listp "nil") | -filter((lambda (x) (and (> (car x) 2) (< (car x) 8))) "nil") | (orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (< (car x) 8))) | d) nil) (let ((d (quote "nil"))) (orgtbl-to-csv (-filter (lambda (x) | (and (> (car x) 2) (< (car x) 8))) d) nil)) (progn (let ((d (quote | "nil"))) (orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (< | (car x) 8))) d) nil))) eval((progn (let ((d (quote "nil"))) | (orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (< (car x) 8))) | d) nil)))) org-babel-execute:emacs-lisp("(orgtbl-to-csv (-filter | (lambda (x) (and (> (car x) 2) (< (car x) 8))) d) nil)" ((:comments . | "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") | (:tangle . "no") (:exports . "code") (:results . "replace") (:var d . | "nil") (:session . "none") (:hlines . "no") (:result-type . value) | (:result-params "replace") (:rowname-names) (:colname-names))) | org-babel-execute-src-block(nil) org-babel-execute-src-block-maybe() | org-babel-execute-maybe() org-babel-execute-safely-maybe() | run-hook-with-args-until-success(org-babel-execute-safely-maybe) | org-ctrl-c-ctrl-c(nil) funcall-interactively(org-ctrl-c-ctrl-c nil) | call-interactively(org-ctrl-c-ctrl-c nil nil) | command-execute(org-ctrl-c-ctrl-c) `---- What could the problem? Thanks again! Uwe