emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Bernd Weiss <bernd.weiss@uni-koeln.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Export properties as (csv) table
Date: Tue, 04 Sep 2012 15:26:21 -0400	[thread overview]
Message-ID: <9788.1346786781@alphaville.americas.hpqcorp.net> (raw)
In-Reply-To: Message from Bernd Weiss <bernd.weiss@uni-koeln.de> of "Tue, 04 Sep 2012 20:04:10 +0200." <5046429A.8080409@uni-koeln.de>

Bernd Weiss <bernd.weiss@uni-koeln.de> 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")

  reply	other threads:[~2012-09-04 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 18:04 Export properties as (csv) table Bernd Weiss
2012-09-04 19:26 ` Nick Dokos [this message]
2012-09-05  4:11   ` Bernd Weiss

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=9788.1346786781@alphaville.americas.hpqcorp.net \
    --to=nicholas.dokos@hp.com \
    --cc=bernd.weiss@uni-koeln.de \
    --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).