From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Referencing elemts of a table Date: Wed, 08 Jun 2011 00:25:11 -0400 Message-ID: <9128.1307507111@alphaville.dokosmarshall.org> References: <2011-06-07T17-53-32@devnull.Karl-Voit.at> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUAKc-0001HD-3d for emacs-orgmode@gnu.org; Wed, 08 Jun 2011 00:25:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUAKa-00013y-0t for emacs-orgmode@gnu.org; Wed, 08 Jun 2011 00:25:26 -0400 Received: from vms173007pub.verizon.net ([206.46.173.7]:36678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUAKZ-00013j-S3 for emacs-orgmode@gnu.org; Wed, 08 Jun 2011 00:25:23 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173007.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LMG00JTBEXZTK00@vms173007.mailsrvcs.net> for emacs-orgmode@gnu.org; Tue, 07 Jun 2011 23:25:17 -0500 (CDT) In-reply-to: Message from kinouchou of "Wed, 08 Jun 2011 02:05:51 +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: kinouchou Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org kinouchou wrote: > Do you know if it's possible for a table in another file? Because in the > manuel i read it's possible but I don't have result. > > (sorry for my english) > Christelle > I assume you mean the "remote references" in section 3.5.1 in the manual: ,---- | You may also reference constants, fields and ranges from a different | table, either in the current file or even in a different file. The | syntax is | | remote(NAME-OR-ID,REF) | | where NAME can be the name of a table in the current file as set by a | `#+TBLNAME: NAME' line before the table. It can also be the ID of an | entry, even in a different file, and the reference then refers to the | first table in that entry. REF is an absolute field or range reference | as described above for example `@3$3' or `$somename', valid in the | referenced table. `---- Here's a simple example - we have a table in one file, foo.org, which refers to a cell in table with ID 17: --8<---------------cut here---------------start------------->8--- * foo #+TBLNAME: foo | a | b | |----+-----| | 1 | 4 | | 2 | 7 | | 3 | 12 | | 4 | 19 | | 5 | 28 | | 6 | 39 | | 7 | 52 | | 8 | 67 | | 9 | 84 | | 10 | 103 | #+TBLFM: $2 = $1*$1 + remote(17, @4$1) --8<---------------cut here---------------end--------------->8--- Here is the file that contains the table with ID 17 - the ID is actually that of an entry and as the snippet of the manual says, the remote reference refers to the first table under that entry. Here we only have one table under the entry, so there is no ambiguity: --8<---------------cut here---------------start------------->8--- * bar :PROPERTIES: :ID: 17 :END: #+TBLNAME: bar | a | b | |---+---| | 1 | | | 2 | | | 3 | | | 4 | | | 5 | | | 6 | | --8<---------------cut here---------------end--------------->8--- In practice, you would probably generate the ID with org-id-uuid or similar to ensure that the ID is unique. If you change the remote reference to e.g remote(17, @3$1) and recalculate, you can see the values in the foo table changing appropriately. Does that answer your question? Nick > > On Tue, Jun 7, 2011 at 7:22 PM, Michael Brand wrote: > > > Hi Karl > > > > You need additionally $# from "Field coordinates in formulas" described > > here: > > http://orgmode.org/manual/References.html#References > > and Calc vector subscript: > > #+TBLFM: @2 = subscr(remote(orgtblA, @2$2..@2$7), $#) > > > > Michael > > > > On Tue, Jun 7, 2011 at 17:55, Karl Voit wrote: > > > I want to define "orgtblB line 2 (row 1 to 6)" should contain the > > > values "from orgtblA, last line, row 2 to 7". > > > > > > I tried > > > > > > #+TBLFM: @2=remote(orgtblA,@2$2..@2$7) > > > > > > and > > > > > > #+TBLFM: @2$1..@2$6=remote(orgtblA,@2$2..@2$7) > > > > > > but that results in a list of 6x 5 values in each field in row 2. > > > > > > Here is an example of my org-tbl-reference-problem: > > > http://paste.grml.org/462/ > > > > >