emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-table-duplicate-column
@ 2013-09-29  8:35 Karl Voit
  2013-09-29  9:42 ` org-table-duplicate-column Michael Brand
  0 siblings, 1 reply; 9+ messages in thread
From: Karl Voit @ 2013-09-29  8:35 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

I often end up creating a table where I do the header and the outer
leftmost column. Then I start by creating the second column with
formulas. In many cases, the following columns are like the previous
one but with, e.g., $3 instead of $2 in all formulas.

Either there is another solution to my work-flow or
org-table-duplicate-column would be a cool new feature :-)

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: org-table-duplicate-column
  2013-09-29  8:35 org-table-duplicate-column Karl Voit
@ 2013-09-29  9:42 ` Michael Brand
  2013-09-29 19:56   ` org-table-duplicate-column Karl Voit
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Brand @ 2013-09-29  9:42 UTC (permalink / raw)
  To: news1142; +Cc: Org Mode

Hi Karl

On Sun, Sep 29, 2013 at 10:35 AM, Karl Voit <devnull@karl-voit.at> wrote:
> I often end up creating a table where I do the header and the outer
> leftmost column. Then I start by creating the second column with
> formulas. In many cases, the following columns are like the previous
> one but with, e.g., $3 instead of $2 in all formulas.

If you are not looking for range formulas

|      | a | b |
|------+---+---|
| 2014 | x | x |
| 2015 | x | x |
#+TBLFM: @<<$<<..@>$> = x

an example would help me to understand.

Michael

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

* Re: org-table-duplicate-column
  2013-09-29  9:42 ` org-table-duplicate-column Michael Brand
@ 2013-09-29 19:56   ` Karl Voit
  2013-09-29 20:51     ` org-table-duplicate-column Michael Brand
  0 siblings, 1 reply; 9+ messages in thread
From: Karl Voit @ 2013-09-29 19:56 UTC (permalink / raw)
  To: emacs-orgmode

* Michael Brand <michael.ch.brand@gmail.com> wrote:
> Hi Karl

Hi!

> If you are not looking for range formulas
>
>|      | a | b |
>|------+---+---|
>| 2014 | x | x |
>| 2015 | x | x |
> #+TBLFM: @<<$<<..@>$> = x
>
> an example would help me to understand.

Sure:

| *Option* | *Evaluation 123* | *Evaluation 234* |
|----------+------------------+------------------|
| Option 1 |               27 |               26 |
| Option 2 |               22 |               24 |
| Option 3 |               16 |               16 |
| Option 4 |               16 |             13.5 |
| Option 5 |                8 |                9 |
| Option 6 |                2 |                4 |
|----------+------------------+------------------|
|          |               91 |             92.5 |
#+TBLFM: @8$2=vsum(@I$2..@II$2)::@8$3=vsum(@I$3..@II$3)

The third column is similar to the second. This is a very simple
example with only one formula per column. Usually I end up with more
formulas which I want to be duplicated as well.

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: org-table-duplicate-column
  2013-09-29 19:56   ` org-table-duplicate-column Karl Voit
@ 2013-09-29 20:51     ` Michael Brand
  2013-09-30 11:43       ` org-table-duplicate-column Karl Voit
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Brand @ 2013-09-29 20:51 UTC (permalink / raw)
  To: news1142; +Cc: Org Mode

Hi Karl

On Sun, Sep 29, 2013 at 9:56 PM, Karl Voit <devnull@karl-voit.at> wrote:
> | *Option* | *Evaluation 123* | *Evaluation 234* |
> |----------+------------------+------------------|
> | Option 1 |               27 |               26 |
> | Option 2 |               22 |               24 |
> | Option 3 |               16 |               16 |
> | Option 4 |               16 |             13.5 |
> | Option 5 |                8 |                9 |
> | Option 6 |                2 |                4 |
> |----------+------------------+------------------|
> |          |               91 |             92.5 |
> #+TBLFM: @8$2=vsum(@I$2..@II$2)::@8$3=vsum(@I$3..@II$3)

I would use

#+TBLFM: @>$<<..@>$> = vsum(@I$0..@II$0)

or the shorter

#+TBLFM: @>$<<..@>$> = vsum(@I..@II)

The $<< vs. $2 etc. leaves TBLFM alone when moving around e. g. column
$2.

Michael

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

* Re: org-table-duplicate-column
  2013-09-29 20:51     ` org-table-duplicate-column Michael Brand
@ 2013-09-30 11:43       ` Karl Voit
  2013-09-30 19:30         ` org-table-duplicate-column Michael Brand
  0 siblings, 1 reply; 9+ messages in thread
From: Karl Voit @ 2013-09-30 11:43 UTC (permalink / raw)
  To: emacs-orgmode

* Michael Brand <michael.ch.brand@gmail.com> wrote:
> Hi Karl

Hi Michael!

> On Sun, Sep 29, 2013 at 9:56 PM, Karl Voit <devnull@karl-voit.at> wrote:
>> | *Option* | *Evaluation 123* | *Evaluation 234* |
>> |----------+------------------+------------------|
>> | Option 1 |               27 |               26 |
>> | Option 2 |               22 |               24 |
>> | Option 3 |               16 |               16 |
>> | Option 4 |               16 |             13.5 |
>> | Option 5 |                8 |                9 |
>> | Option 6 |                2 |                4 |
>> |----------+------------------+------------------|
>> |          |               91 |             92.5 |
>> #+TBLFM: @8$2=vsum(@I$2..@II$2)::@8$3=vsum(@I$3..@II$3)
>
> I would use
>
> #+TBLFM: @>$<<..@>$> = vsum(@I$0..@II$0)
> or the shorter
> #+TBLFM: @>$<<..@>$> = vsum(@I..@II)

Never used this kind of reference yet. 

What about alternating data (no summary value at bottom row) and
evaluation columns?

| Data 1 | Eval 1 | Data 2 | Eval 2 |

What about moving columns:

Switching two columns from:
| Eval 1 | Eval 2 | foo | bar |
to:
| Eval 1 | foo | Eval 2 | bar |

("foo" and "bar" do not have those formula fields like Eval columns)

Besides the fact that I personally prefer single column
formulas for legibility and maintainability. I had to spend a minute
to understand "@>$<<..@>$> = vsum(@I..@II)" and I am afraid that I
have to re-spend this minute in three weeks when I have to add data
to the table.

So, yes you clearly helped with the example I posted. However, I
have got the feeling that this method is not able to solve my issue
in all cases. I still tend to think that org-table-duplicate-column
would be handy in many cases.

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: org-table-duplicate-column
  2013-09-30 11:43       ` org-table-duplicate-column Karl Voit
@ 2013-09-30 19:30         ` Michael Brand
  2013-10-01 15:50           ` org-table-duplicate-column Karl Voit
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Brand @ 2013-09-30 19:30 UTC (permalink / raw)
  To: news1142; +Cc: Org Mode

Hi Karl

On Mon, Sep 30, 2013 at 1:43 PM, Karl Voit <devnull@karl-voit.at> wrote:
> What about alternating data (no summary value at bottom row) and
> evaluation columns?
>
> | Data 1 | Eval 1 | Data 2 | Eval 2 |
>
> What about moving columns:
>
> Switching two columns from:
> | Eval 1 | Eval 2 | foo | bar |
> to:
> | Eval 1 | foo | Eval 2 | bar |

Alternation and moving can be handled with conditional formulas

#+TBLFM: @>$<..@>$> = if(subvec("@1", 2, 6) == "Eval", 42, $0)

in Calc or even simpler (regex) with Lisp. Don't worry, For this I had
to cheat and look in testing/lisp/test-org-table.el with the ERTs that
should also be an advanced documentation. In this case
test-org-table/compare for the comparison and
test-org-table/copy-field for the substring.

> I still tend to think that org-table-duplicate-column
> would be handy in many cases.

I can not understand how with a variable if you mean that
literally. Also with macros for TBLFM as I imagine, that could be
difficult because already now there are conflicts and traps with the
TBLFM syntax.

Michael

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

* Re: org-table-duplicate-column
  2013-09-30 19:30         ` org-table-duplicate-column Michael Brand
@ 2013-10-01 15:50           ` Karl Voit
  2013-10-01 16:25             ` org-table-duplicate-column Michael Brand
  0 siblings, 1 reply; 9+ messages in thread
From: Karl Voit @ 2013-10-01 15:50 UTC (permalink / raw)
  To: emacs-orgmode

Hi Michael!

* Michael Brand <michael.ch.brand@gmail.com> wrote:
>
> On Mon, Sep 30, 2013 at 1:43 PM, Karl Voit <devnull@karl-voit.at> wrote:
>> What about alternating data (no summary value at bottom row) and
>> evaluation columns?
>>
>> | Data 1 | Eval 1 | Data 2 | Eval 2 |
>>
>> What about moving columns:
>>
>> Switching two columns from:
>> | Eval 1 | Eval 2 | foo | bar |
>> to:
>> | Eval 1 | foo | Eval 2 | bar |
>
> Alternation and moving can be handled with conditional formulas
>
> #+TBLFM: @>$<..@>$> = if(subvec("@1", 2, 6) == "Eval", 42, $0)
>
> in Calc or even simpler (regex) with Lisp. Don't worry, For this I had
> to cheat and look in testing/lisp/test-org-table.el with the ERTs that
> should also be an advanced documentation. In this case
> test-org-table/compare for the comparison and
> test-org-table/copy-field for the substring.

:-)

I could not follow this example without looking into a manual
either.

>> I still tend to think that org-table-duplicate-column
>> would be handy in many cases.
>
> I can not understand how with a variable if you mean that
> literally. Also with macros for TBLFM as I imagine, that could be
> difficult because already now there are conflicts and traps with the
> TBLFM syntax.

I assume, there is a misunderstanding.

What I mean: I have got the following table with two columns
containing two different data columns and one result column
which contains two formulas:

| data1 | data2 | results1 |
|-------+-------+----------|
|     1 |   643 |        2 |
|     4 |    22 |        8 |
|     6 |    91 |       12 |
|-------+-------+----------|
|       |       |       22 |
#+TBLFM: $3=$1*2::@5$3=vsum(@I$3..@II$3)

While being in the outer right column and doing "M-x
org-table-duplicate-column", Org-mode simply duplicates the column
and its related TBLFM entries accordingly:

| data1 | data2 | results1 | results1 |
|-------+-------+----------+----------|
|     1 |   643 |        2 |        2 |
|     4 |    22 |        8 |        8 |
|     6 |    91 |       12 |       12 |
|-------+-------+----------+----------|
|       |       |       22 |       22 |
#+TBLFM: $3=$1*2::@5$3=vsum(@I$3..@II$3) :: $4=$1*2::@5$4=vsum(@I$4..@II$4)

This should be a pretty simple operation in cases where there are no
complicated references.

Then I adopt the resulting TBLFM with only minor effort (*instead of
writing everything from scratch*) and get my similar but not same
forth column:

| data1 | data2 | results1 | results2 |
|-------+-------+----------+----------|
|     1 |   643 |        2 |   321.50 |
|     4 |    22 |        8 |    11.00 |
|     6 |    91 |       12 |    45.50 |
|-------+-------+----------+----------|
|       |       |       22 |   378.00 |
#+TBLFM: $3=$1*2::@5$3=vsum(@I$3..@II$3) :: $4=$2/2;%.2f::@5$4=vsum(@I$4..@II$4);%.2f

Probably I have a different approach because I am clearly no calc
pro user (I need only basics) and I want to keep formulas (and
references) easy to read (maintainability).

Does this make any sense for you?

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

* Re: org-table-duplicate-column
  2013-10-01 15:50           ` org-table-duplicate-column Karl Voit
@ 2013-10-01 16:25             ` Michael Brand
  2013-10-01 19:33               ` org-table-duplicate-column Karl Voit
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Brand @ 2013-10-01 16:25 UTC (permalink / raw)
  To: news1142; +Cc: Org Mode

Hi Karl

On Tue, Oct 1, 2013 at 5:50 PM, Karl Voit <devnull@karl-voit.at> wrote:
> I assume, there is a misunderstanding.

Yes there was. With your clean example I understand now.

> [your example]
>
> Does this make any sense for you?

Yes, it absolutely does. Only that someone would have to implement the
missing function org-table-duplicate-column... If you don't already
know it you can use the table formula editor "C-c '" for this in the
meantime to at least copy/paste the formulas for the new column.

Michael

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

* Re: org-table-duplicate-column
  2013-10-01 16:25             ` org-table-duplicate-column Michael Brand
@ 2013-10-01 19:33               ` Karl Voit
  0 siblings, 0 replies; 9+ messages in thread
From: Karl Voit @ 2013-10-01 19:33 UTC (permalink / raw)
  To: emacs-orgmode

Hi!

* Michael Brand <michael.ch.brand@gmail.com> wrote:
>
> On Tue, Oct 1, 2013 at 5:50 PM, Karl Voit <devnull@karl-voit.at> wrote:
>> I assume, there is a misunderstanding.
>
> Yes there was. With your clean example I understand now.

Sorry that I was not able to describe the issue in the first place.

>> [your example]
>>
>> Does this make any sense for you?
>
> Yes, it absolutely does. Only that someone would have to implement the
> missing function org-table-duplicate-column... If you don't already
> know it you can use the table formula editor "C-c '" for this in the
> meantime to at least copy/paste the formulas for the new column.

Thanks. This is how I do it for now.

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github

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

end of thread, other threads:[~2013-10-01 19:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-29  8:35 org-table-duplicate-column Karl Voit
2013-09-29  9:42 ` org-table-duplicate-column Michael Brand
2013-09-29 19:56   ` org-table-duplicate-column Karl Voit
2013-09-29 20:51     ` org-table-duplicate-column Michael Brand
2013-09-30 11:43       ` org-table-duplicate-column Karl Voit
2013-09-30 19:30         ` org-table-duplicate-column Michael Brand
2013-10-01 15:50           ` org-table-duplicate-column Karl Voit
2013-10-01 16:25             ` org-table-duplicate-column Michael Brand
2013-10-01 19:33               ` org-table-duplicate-column Karl Voit

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