emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to pass named table reference in source block variable


From: Roland Donat
Subject: Re: [O] How to pass named table reference in source block variable
Date: Thu, 8 Aug 2013 15:42:14 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Schulte <schulte.eric <at> gmail.com> writes:

> 
> It sounds like you want to use tables like key-value stores.  I think
> adding such behavior directly to Org-mode would overly complicate the
> data structures passed between code blocks (which currently only
> consists of scalars and tables).  However, maybe the following could
> work.
> 
> 
> Attachment (key-value.org): text/x-org, 776 bytes
> 
> 
> Cheers,
> 

Thanks for the attachment. It works fine indeed!
But should it be so complicated to add this behavior to Org-mode?

I can rewrite your table as follows :

#+name: table
|   | keys | values |
|---+------+--------|
|   | foo  | 1      |
| ^ |      | foo    |
|   | bar  | 2      |
| ^ |      | bar    |

Now I can refer to bar value as $bar in org-table. 

So, my suggestion is only to mimic this feature to assign value of source 
block variable like :

#+headers: :results verbatim
#+begin_src sh :var foo=table$foo :var bar=table$bar
  cat <<EOF
  Pulling the data from the above table we find
  that foo is $foo and baz is $bar.
  EOF
#+end_src

But anyway, thanks for the solution.

Cheers.

Roland.









reply via email to

[Prev in Thread] Current Thread [Next in Thread]