From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Export properties as (csv) table Date: Tue, 04 Sep 2012 15:26:21 -0400 Message-ID: <9788.1346786781@alphaville.americas.hpqcorp.net> References: <5046429A.8080409@uni-koeln.de> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8zzD-0000ly-AI for emacs-orgmode@gnu.org; Tue, 04 Sep 2012 16:44:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8zzC-0000FX-2b for emacs-orgmode@gnu.org; Tue, 04 Sep 2012 16:44:39 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:42074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8zzB-0000FT-Rz for emacs-orgmode@gnu.org; Tue, 04 Sep 2012 16:44:37 -0400 In-Reply-To: Message from Bernd Weiss of "Tue, 04 Sep 2012 20:04:10 +0200." <5046429A.8080409@uni-koeln.de> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernd Weiss Cc: emacs-orgmode@gnu.org Bernd Weiss wrote: > Dear all, > > Let's say I have the following entries and their associated > properties. Is there an easy way to export these information as csv > formated table? > > * Marc, Mart :Mart_Marc:: > :PROPERTIES: > :name: Marc, Mart > :typ: diss > :empirisch: ja > :status: angemeldet > :END: > * Marc, Mart2 :Mart_Marc2: > :PROPERTIES: > :name: Marc, Mart2 > :typ: diss > :empirisch: ja > :status: angemeldet > :END: > > The final csv table would look like this: > > name, typ, empirisch, status > Mart, Marc; diss; ja; angemeldet > Mart2, Marc; diss; ja; angemeldet > > > I played around with dynamic blocks and spent some time trying to > understand the property API but since my elips skills are very (very) > limited to no avail... > Perhaps a combination of a columnview dblock[fn:1] to produce a table and then a radio table with a translation function[fn:2]: --8<---------------cut here---------------start------------->8--- #+COLUMNS: %name %typ %empirisch %status * Marc, Mart :Mart_Marc:: :PROPERTIES: :name: Marc, Mart :typ: diss :empirisch: ja :status: angemeldet :END: * Marc, Mart2 :Mart_Marc2: :PROPERTIES: :name: Marc, Mart2 :typ: diss :empirisch: nein :status: angemeldet :END: * The column view #+ORGTBL: SEND foo orgtbl-to-csv #+BEGIN: columnview :hlines 1 :id global #+END: #+BEGIN_EXAMPLE BEGIN RECEIVE ORGTBL foo END RECEIVE ORGTBL foo #+END_EXAMPLE --8<---------------cut here---------------end--------------->8--- C-c C-c on the columnview dblock will create a table from the properties using the COLUMNS definition: --8<---------------cut here---------------start------------->8--- * The column view #+ORGTBL: SEND foo orgtbl-to-csv #+BEGIN: columnview :hlines 1 :id global | name | typ | empirisch | status | |-------------+------+-----------+------------| | Marc, Mart | diss | ja | angemeldet | | Marc, Mart2 | diss | nein | angemeldet | | | | | | #+END: --8<---------------cut here---------------end--------------->8--- In order to accomplish the radio-table sending part, I had to switch the ORGTBL and BEGIN lines, otherwise the sending is not activated. This might qualify as a bug. So it looks like this: --8<---------------cut here---------------start------------->8--- * The column view #+BEGIN: columnview :hlines 1 :id global #+ORGTBL: SEND foo orgtbl-to-csv | name | typ | empirisch | status | |-------------+------+-----------+------------| | Marc, Mart | diss | ja | angemeldet | | Marc, Mart2 | diss | nein | angemeldet | | | | | | #+END: --8<---------------cut here---------------end--------------->8--- Then C-c C-c in the table sends it to the target: --8<---------------cut here---------------start------------->8--- * The column view #+BEGIN: columnview :hlines 1 :id global #+ORGTBL: SEND foo orgtbl-to-csv | name | typ | empirisch | status | |-------------+------+-----------+------------| | Marc, Mart | diss | ja | angemeldet | | Marc, Mart2 | diss | nein | angemeldet | | | | | | #+END: #+BEGIN_EXAMPLE BEGIN RECEIVE ORGTBL foo name,typ,empirisch,status "Marc, Mart",diss,ja,angemeldet "Marc, Mart2",diss,nein,angemeldet ,,, END RECEIVE ORGTBL foo #+END_EXAMPLE --8<---------------cut here---------------end--------------->8--- Nick Footnotes: [fn:1] (info "(org) Capturing column view") [fn:2] (info "(org) Tables in arbitrary syntax")