emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Derek Feichtinger <dfeich@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: org table with auto-incrementing numbers in a column
Date: Tue, 16 Feb 2016 06:22:43 +0000 (UTC)	[thread overview]
Message-ID: <loom.20160216T071346-143@post.gmane.org> (raw)
In-Reply-To: CAFyQvY3qE8TauR3fW=z7_y7ijFwR1ZOWM4nayKezrthYy9bHSw@mail.gmail.com

Hi

Kaushal Modi <kaushal.modi <at> gmail.com> writes:

> 
> Hi,
> I am trying to get auto-incrementing numbers in the first column in an org
table. The goal is to recalculate the numbers after adding/removing rows.
> 
> I checked out the org
FAQ: http://orgmode.org/worg/org-faq.html#fill-table-column-with-incremental-numbers
> 
> 
> But I am still not getting it to work as I need to.
> 
> Below is the minimum working example. Paste the below in an org buffer.
> 
> 
> 
> | N |   |
> |---+---|
> |   |   |
> |   |   |
> |   |   |
> |   |   |
> #+TBLFM: $1= <at> -1+1:: <at> 2$1=1
> 
> 

Try this

  | N |   |
  |---+---|
  |   |   |
  |   |   |
  |   |   |
  |   |   |
  #+TBLFM: <at>$1..<at>>$1= <at>-1 + 1:: <at>2$1=1


One problem is that $1 also includes the first row with the "N" heading.
that is why in your example the second and third lines both will at first
contain 1 (at least with my org version 8.3.3), and in the second iteration
only show the correct series.

> Now with the point anywhere in the table, when I hit "C-c *" or M-x
org-table-recalculate, I expect the first column to be auto-populated with
numbers 1,2,3,4 (or that's how I understood from the tutorial in the FAQ
link above).
> 
> But it does not work that way. Instead I need to go to each row and hit C-c *.

Placing point on the TBLFM line and doing C-c C-c should recalculate the
whole table.


Cheers,
Derek



  reply	other threads:[~2016-02-16  6:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-16  4:36 org table with auto-incrementing numbers in a column Kaushal Modi
2016-02-16  6:22 ` Derek Feichtinger [this message]
2016-02-16  7:24   ` H. Dieter Wilhelm
2016-02-16  9:16     ` Derek Feichtinger
2016-02-16 16:51       ` Nicolas Goaziou
2016-02-16  9:58   ` Eric S Fraga
2016-02-16 16:28     ` Kaushal Modi

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=loom.20160216T071346-143@post.gmane.org \
    --to=dfeich@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).