From mboxrd@z Thu Jan 1 00:00:00 1970 From: Karl Voit Subject: Re: org-table-duplicate-column Date: Tue, 1 Oct 2013 17:50:51 +0200 Message-ID: <2013-10-01T17-37-37@devnull.Karl-Voit.at> References: <2013-09-29T10-33-04@devnull.Karl-Voit.at> <2013-09-29T21-49-38@devnull.Karl-Voit.at> <2013-09-30T13-29-05@devnull.Karl-Voit.at> Reply-To: news1142@Karl-Voit.at Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VR2EC-0006Y0-3A for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 11:51:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VR2E5-0002VG-L2 for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 11:51:12 -0400 Received: from plane.gmane.org ([80.91.229.3]:40626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VR2E5-0002V5-EB for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 11:51:05 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VR2E3-0007JC-MC for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 17:51:03 +0200 Received: from mail.michael-prokop.at ([88.198.6.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Oct 2013 17:51:03 +0200 Received: from news1142 by mail.michael-prokop.at with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 01 Oct 2013 17:51:03 +0200 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: emacs-orgmode@gnu.org Hi Michael! * Michael Brand wrote: > > On Mon, Sep 30, 2013 at 1:43 PM, Karl Voit 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