emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* column formulas: Row descriptor -1 used in line ### leads outside table
@ 2011-08-04 18:24 andersvi
  2011-08-04 18:41 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: andersvi @ 2011-08-04 18:24 UTC (permalink / raw)
  To: emacs-orgmode

Anyone have suggestions about how i can have a column-formula refer to
value in previous row, but ignore the row before the first line?

Something like this:

    | 1 | 4 |   |
    | 2 | 7 |   |
    | 3 | 1 |   |
    #+TBLFM: $2=random(10)::$3=(@-1$2)-$2

Evaluating this returns an error:

  "Row descriptor -1 used in line 547 leads outside table"

I tried using a lisp-expression to dispatch on the row-number, but it
doesnt seem to consider 'if as a special-form, trying to evaluate its
last argument anyhow.

    | 1 | 2 |   |
    | 2 | 6 |   |
    | 3 | 2 |   |
    #+TBLFM: $2=random(10)::$3='(if (< @# 3) 0 (- @-1$2 $2))

but get the same error.

Thanks,

-anders

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

* Re: column formulas: Row descriptor -1 used in line ### leads outside table
  2011-08-04 18:24 column formulas: Row descriptor -1 used in line ### leads outside table andersvi
@ 2011-08-04 18:41 ` Nick Dokos
  2011-08-04 19:41   ` andersvi
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2011-08-04 18:41 UTC (permalink / raw)
  To: andersvi; +Cc: nicholas.dokos, emacs-orgmode

andersvi@notam02.no wrote:

> Anyone have suggestions about how i can have a column-formula refer to
> value in previous row, but ignore the row before the first line?
> 
> Something like this:
> 
>     | 1 | 4 |   |
>     | 2 | 7 |   |
>     | 3 | 1 |   |
>     #+TBLFM: $2=random(10)::$3=(@-1$2)-$2
> 
> Evaluating this returns an error:
> 
>   "Row descriptor -1 used in line 547 leads outside table"
> 
> I tried using a lisp-expression to dispatch on the row-number, but it
> doesnt seem to consider 'if as a special-form, trying to evaluate its
> last argument anyhow.
> 
>     | 1 | 2 |   |
>     | 2 | 6 |   |
>     | 3 | 2 |   |
>     #+TBLFM: $2=random(10)::$3='(if (< @# 3) 0 (- @-1$2 $2))
> 
> but get the same error.
> 

Set the cell in the first line explicitly with a field formula (or just
a value): it overrides the column formula. Something like this:

#+TBLFM: $2=random(10)::$3=(@-1$2)-$2::@1$3 = 0

Nick

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

* Re: column formulas: Row descriptor -1 used in line ### leads outside table
  2011-08-04 18:41 ` Nick Dokos
@ 2011-08-04 19:41   ` andersvi
  0 siblings, 0 replies; 3+ messages in thread
From: andersvi @ 2011-08-04 19:41 UTC (permalink / raw)
  To: emacs-orgmode

>>>>> "N" == Nick Dokos <nicholas.dokos@hp.com> writes:

    N> Set the cell in the first line explicitly with a field formula
    N> (or just a value): it overrides the column formula.

Thanks.

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

end of thread, other threads:[~2011-08-04 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 18:24 column formulas: Row descriptor -1 used in line ### leads outside table andersvi
2011-08-04 18:41 ` Nick Dokos
2011-08-04 19:41   ` andersvi

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