Re: [O] Referencing elemts of a table
Hi Karl On Wed, Jun 8, 2011 at 14:49, Karl Voit wrote: > * Michael Brand wrote: >> 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), $#) > > This was the thing I was missing! Thank you! > > But on the page of the URL mentioned above there is nothing > related to »subscr« at all. Is there a more verbose reference I do > not know yet? Org table spreadsheet gives access to Emacs Calc that has its own manual and subscr is in chapter "Extracting Vector Elements": (info "(Calc)Extracting Elements") Michael
Re: [O] Referencing elemts of a table
Karl Voit wrote: > * 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), $#) > > This was the thing I was missing! Thank you! > > But on the page of the URL mentioned above there is nothing > related to »subscr« at all. Is there a more verbose reference I do > not know yet? Yes, it's documented in the Calc manual, section 11.3, "Extracting Vector Elements". I'd encourage you to write up a short tutorial on your use case: it's interesting, non-trivial and perhaps a nice introduction to using Calc functions in Org tables. Worg would be a better place for it! Nick
Re: [O] Referencing elemts of a table
* 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), $#) This was the thing I was missing! Thank you! But on the page of the URL mentioned above there is nothing related to »subscr« at all. Is there a more verbose reference I do not know yet? -- Karl Voit
Re: [O] Referencing elemts of a table
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/ > > > > >
Re: [O] Referencing elemts of a table
> 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. M-x orgtbl-mode? --
Re: [O] Referencing elemts of a table
Hello, 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 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/ > >
Re: [O] Referencing elemts of a table
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/