emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mario Frasca <mario@anche.no>
To: emacs-orgmode@gnu.org
Subject: bug: Row descriptor <...> leads outside table
Date: Fri, 3 Jul 2020 09:53:36 -0500	[thread overview]
Message-ID: <b0d2817b-d2d3-29ab-e626-04eeb7054842@anche.no> (raw)
In-Reply-To: <d8882a83-7220-7518-a5d4-68a89a79d99d@anche.no>

hi again,

I haven't found how to solve this, short of removing the evaluation of 
`user-error' from the org-table.el code, or stuffing my TBLFM line with 
field formulas.

a very simple use case: three columns: the date, a daily measurement, 
and a running 4-days average.

|  date | measure | running avg ||-------+---------+-------------|| 
01-27 |     604 | skipped     || 01-28 |     314 | skipped     || 01-29 
|     636 | skipped     || 01-30 |     305 | skipped     || 01-31 |     
760 | skipped     || 02-01 |     531 | skipped     || 02-02 |     331 | 
nil         || 02-03 |      77 | nil         || 02-04 |     621 | 
nil         || 02-05 |     406 | nil         || 02-06 |     621 | 
nil         || 02-07 |     975 | nil         || 02-08 |     252 | 
nil         || 02-09 |     794 | nil         || 02-10 |      36 | 
nil         |#+TBLFM: $3='(unless (> @# 7) "skipped") #+TBLFM: $3='(when 
(> @# 7) (/ (apply #'+ '(@-6$2..$2)) 7.0));N%0.2f #+TBLFM: $3='(/ (apply 
#'+ '(@-6$2..$2)) 
7.0);N%0.2f::@2$3='(string)::@3$3='(string)::@4$3='(string)::@5$3='(string)::@6$3='(string)::@7$3='(string)

the first TBLFM shows you which cells I'm skipping, that is, where I'm 
not applying the @-6 reference.  the status of the table results from 
evaluation of that TBLFM line.

the second TBLFM line skips all @-6 references, but still fails with the 
message

user-error: Row descriptor -6 leads outside table

the third TBLFM line "solves" the problem, in one of the ugliestests ways.

how would you people approach this?


On 29/06/2020 12:03, Mario Frasca wrote:
> Hi,
>
> I need some help understanding how to use org-mode/org-table for 
> references leading outside my table.
>
> I have a series of daily figures, and I am computing the series of 
> running sums.  column one is the daily data, column two is the running 
> sum of the preceding 14 values from column 1.
>
> http://ix.io/2qu7
>
> problem is the @-13$1 reference in the function for the second column: 
> it hits a software-generated "user-error: Row descriptor -13 leads 
> outside table".
>
> this happens even if the formula says (if (> @# 13) (apply '+ 
> '(@-13$1..$1)) 0), that is, even if the formula is not evaluated on 
> the cells where the reference does indeed lead out of the table.
>
> this happens around line 2809 of org-table.el, inside org-table--row-type
>
> I've tried to catch the user-error with a `condition-case', but even 
> there, the error seems to happen before evaluation.
>
> I've replaced the `(user-error)' function with a `nil', and it works 
> for me, but that's a very rough measure I'm afraid.
>


  reply	other threads:[~2020-07-03 14:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 17:03 question on user-error reference leading out of table Mario Frasca
2020-07-03 14:53 ` Mario Frasca [this message]
2020-07-03 14:55   ` bug: Row descriptor <...> leads outside table Mario Frasca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b0d2817b-d2d3-29ab-e626-04eeb7054842@anche.no \
    --to=mario@anche.no \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: bug: Row descriptor <...> leads outside table' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this 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).