emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Export properties as (csv) table
@ 2012-09-04 18:04 Bernd Weiss
  2012-09-04 19:26 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Bernd Weiss @ 2012-09-04 18:04 UTC (permalink / raw)
  To: emacs-orgmode

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...

Thanks,

Bernd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Export properties as (csv) table
  2012-09-04 18:04 Export properties as (csv) table Bernd Weiss
@ 2012-09-04 19:26 ` Nick Dokos
  2012-09-05  4:11   ` Bernd Weiss
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2012-09-04 19:26 UTC (permalink / raw)
  To: Bernd Weiss; +Cc: emacs-orgmode

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")

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Export properties as (csv) table
  2012-09-04 19:26 ` Nick Dokos
@ 2012-09-05  4:11   ` Bernd Weiss
  0 siblings, 0 replies; 3+ messages in thread
From: Bernd Weiss @ 2012-09-05  4:11 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

On 04.09.2012 21:26, Nick Dokos wrote:

[...]

> Perhaps a combination of a columnview dblock[fn:1] to produce a table
> and then a radio table with a translation function[fn:2]:

[...]

Thanks, Nick! Works like a charm!

Bernd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-05  4:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-04 18:04 Export properties as (csv) table Bernd Weiss
2012-09-04 19:26 ` Nick Dokos
2012-09-05  4:11   ` Bernd Weiss

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).