emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-collector calculated rows?
@ 2011-03-03 16:16 Rehan Iftikhar
  2011-03-05  8:43 ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Rehan Iftikhar @ 2011-03-03 16:16 UTC (permalink / raw)
  To: emacs-orgmode

Hi Org list!

For those of you familiar with org-collector (ie. propview dynamic
block) is there already a way to include a calculated row?

For example, in the demonstration of how to use org-collector @
http://orgmode.org/worg/org-contrib/org-collector.html, I'd be
interested in:
  * Simple Example: displaying the sum of the "Amount" column
  * More Complex Example: displaying the mean of the "Amount" column
for each week.

Does anything like this already exist?

-- 
-Rehan

-- 
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: org-collector calculated rows?
  2011-03-03 16:16 org-collector calculated rows? Rehan Iftikhar
@ 2011-03-05  8:43 ` Nick Dokos
  2011-03-05  8:48   ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2011-03-05  8:43 UTC (permalink / raw)
  To: Rehan Iftikhar; +Cc: nicholas.dokos, emacs-orgmode

Rehan Iftikhar <rehan.iftikhar@gmail.com> wrote:

> Hi Org list!
> 
> For those of you familiar with org-collector (ie. propview dynamic
> block) is there already a way to include a calculated row?
> 
> For example, in the demonstration of how to use org-collector @
> http://orgmode.org/worg/org-contrib/org-collector.html, I'd be
> interested in:
>   * Simple Example: displaying the sum of the "Amount" column
>   * More Complex Example: displaying the mean of the "Amount" column
> for each week.
> 
> Does anything like this already exist?
> 

You can do that, but you have to take some care. The following uses
formula syntax from very recent org-mode (e.g.  the last row, last
column designation @>$> does not work in older versions and you'd have
to resort to the old, deprecated notation $LR2) but other than that it
should work with no problems in org-mode 7.x say (and probably older
versions as well).

I can add a formula to each of the tables to calculate
the sum in the first case and the mean in the second case.
Adding an item and then recalculating the tables by pressing
C-c C-c on each #+BEGIN line works fine.

The thing that does not quite work is initialization: you cannot start
with empty #+BEGIN/#+END sections, add the formula and then press C-c
C-c: that gives an error[fn:1]. But pressing C-c C-c first, thereby
populating the table, and *then* adding the formula works fine. C-c C-c
will not only repopulate the table but also recalculate the formula.

HTH,
Nick


--8<---------------cut here---------------start------------->8---

* Example

#+BEGIN: propview :id "december" :conds ((string= spendtype "food")) :cols (ITEM amount)
| "ITEM"                           | "amount" |
|----------------------------------+----------|
| "Grocery Store [2008-12-01 Mon]" |    56.77 |
| "Restaurant [2008-12-08 Mon]"    |    30.67 |
| "Grocery Store [2008-12-09 Tue]" |    56.76 |
|----------------------------------+----------|
|                                  |    144.2 |
#+TBLFM: @>$> = vsum(@I..II)  
#+END:

#+BEGIN: propview :cols (ITEM (+ 400 amount)) :scope tree :match "example"
| "ITEM"                           | "(+ 400 amount)" |
|----------------------------------+------------------|
| "December Spending"              |                0 |
| "Week One"                       |                0 |
| "Grocery Store [2008-12-01 Mon]" |           456.77 |
| "Athletic club [2008-12-02 Tue]" |            475.0 |
| "Week Two "                      |                0 |
| "Restaurant [2008-12-08 Mon]"    |           430.67 |
| "Grocery Store [2008-12-09 Tue]" |           456.76 |
|----------------------------------+------------------|
|                                  |        259.88571 |
#+TBLFM: @>$> = vmean(@I..II)
#+END:

** December Spending						       :example:
   :PROPERTIES:
   :ID:       december
   :END:

*** Week One
**** Grocery Store [2008-12-01 Mon]
     :PROPERTIES:
     :amount: 56.77
     :spendtype: food
     :END:
**** Athletic club [2008-12-02 Tue]
     :PROPERTIES:
     :amount: 75.00
     :spendtype: health
     :END:
*** Week Two 
**** Restaurant [2008-12-08 Mon]
     :PROPERTIES:
     :amount: 30.67
     :spendtype: food
     :END:
**** Grocery Store [2008-12-09 Tue]
     :PROPERTIES:
     :amount: 56.76
     :spendtype: food
     :END:
--8<---------------cut here---------------end--------------->8---

Footnotes:
[fn:1] The error I get is

Debugger entered--Lisp error: (error "(wrong-type-argument stringp nil)")
  signal(error ("(wrong-type-argument stringp nil)"))
  error("%s" (wrong-type-argument stringp nil))
  (condition-case er (let ((cols (plist-get params :cols)) (inherit (plist-get params :inherit)) (conds (plist-get params :conds)) (match (plist-get params :match)) (scope (plist-get params :scope)) (content-lines (org-split-string (plist-get params :content) "\n")) id table line pos) (save-excursion (when (setq id (plist-get params :id)) (cond ((not id) nil) ((eq id (quote global)) (goto-char (point-min))) ((eq id (quote local)) nil) ((setq idpos (org-find-entry-with-id id)) (goto-char idpos)) (t (error "Cannot find entry with :ID: %s" id)))) (org-narrow-to-subtree) (setq table (org-propview-to-table (org-propview-collect cols conds match scope inherit))) (widen)) (setq pos (point)) (when content-lines (while (string-match "^#" (car content-lines)) (insert (pop content-lines) "\n"))) (ins
 ert table) (insert "\n|--") (org-cycle) (move-end-of-line 1) (message (format "point-%d" pos)) (while (setq line (pop content-lines)) (when (string-match "^#" line) (insert "\n" line))) (got
 o-char pos) (org-table-recalculate (quote all))) (org-collector-error (widen) (error "%s" er)) (error (widen) (error "%s" er)))
  org-dblock-write:propview((:name "propview" :id "december" :conds ((string= spendtype "food")) :cols (ITEM amount) :indentation-column 0 :content #("#+TBLFM: @>$> = vsum(@I..II)  \n" 0 29 (font-lock-fontified t org-category "collector" fontified t face org-meta-line) 29 30 (font-lock-fontified t org-category "collector" fontified t rear-nonsticky t face org-meta-line) 30 31 (fontified t font-lock-fontified t face org-meta-line))))
  funcall(org-dblock-write:propview (:name "propview" :id "december" :conds ((string= spendtype "food")) :cols (ITEM amount) :indentation-column 0 :content #("#+TBLFM: @>$> = vsum(@I..II)  \n" 0 29 (font-lock-fontified t org-category "collector" fontified t face org-meta-line) 29 30 (font-lock-fontified t org-category "collector" fontified t rear-nonsticky t face org-meta-line) 30 31 (fontified t font-lock-fontified t face org-meta-line))))
  (let* ((pos (point)) (line (org-current-line)) (params (org-prepare-dblock)) (name (plist-get params :name)) (indent (plist-get params :indentation-column)) (cmd (intern (concat "org-dblock-write:" name)))) (message "Updating dynamic block `%s' at line %d..." name line) (funcall cmd params) (message "Updating dynamic block `%s' at line %d...done" name line) (goto-char pos) (when (and indent (> indent 0)) (setq indent (make-string indent 32)) (save-excursion (org-beginning-of-dblock) (forward-line 1) (while (not (looking-at org-dblock-end-re)) (insert indent) (beginning-of-line 2)) (when (looking-at org-dblock-end-re) (and (looking-at "[ 	]+") (replace-match "")) (insert indent)))))
  (save-window-excursion (let* ((pos (point)) (line (org-current-line)) (params (org-prepare-dblock)) (name (plist-get params :name)) (indent (plist-get params :indentation-column)) (cmd (intern (concat "org-dblock-write:" name)))) (message "Updating dynamic block `%s' at line %d..." name line) (funcall cmd params) (message "Updating dynamic block `%s' at line %d...done" name line) (goto-char pos) (when (and indent (> indent 0)) (setq indent (make-string indent 32)) (save-excursion (org-beginning-of-dblock) (forward-line 1) (while (not (looking-at org-dblock-end-re)) (insert indent) (beginning-of-line 2)) (when (looking-at org-dblock-end-re) (and (looking-at "[ 	]+") (replace-match "")) (insert indent))))))
  org-update-dblock()
  (save-excursion (org-update-dblock))
  (cond ((or (and (boundp (quote org-clock-overlays)) org-clock-overlays) org-occur-highlights org-latex-fragment-image-overlays) (and (boundp (quote org-clock-overlays)) (org-clock-remove-overlays)) (org-remove-occur-highlights) (org-remove-latex-fragment-image-overlays) (message "Temporary highlights/overlays removed from current buffer")) ((and (local-variable-p (quote org-finish-function) (current-buffer)) (fboundp org-finish-function)) (funcall org-finish-function)) ((run-hook-with-args-until-success (quote org-ctrl-c-ctrl-c-hook))) ((or (looking-at org-property-start-re) (org-at-property-p)) (call-interactively (quote org-property-action))) ((org-on-target-p) (call-interactively (quote org-update-radio-target-regexp))) ((and (org-in-regexp "\\[\\([0-9]*%\\|[0-9]*/[0-9]*\\)\\]") (or (
 org-on-heading-p) (org-at-item-p))) (call-interactively (quote org-update-statistics-cookies))) ((org-on-heading-p) (call-interactively (quote org-set-tags))) ((org-at-table\.el-p) (message 
 "Use C-c ' to edit table.el tables")) ((org-at-table-p) (org-table-maybe-eval-formula) (if arg (call-interactively (quote org-table-recalculate)) (org-table-maybe-recalculate-line)) (call-interactively (quote org-table-align)) (orgtbl-send-table (quote maybe))) ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) (call-interactively (quote org-footnote-action))) ((org-at-item-checkbox-p) (let* ((cbox (match-string 1)) (struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-entry-get nil "ORDERED")) (firstp (= (org-list-get-top-point struct) (point-at-bol))) block-item) (org-list-set-checkbox (point-at-bol) struct (cond ((equal arg (quote ...)) "[-]") ((equal arg (quote ...)) nil
 ) ((equal "[ ]" cbox) "[X]") (t "[ ]"))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (setq block-item (org-list-struct-fix-box struct parents prevs ordere
 dp)) (when block-item (message "Checkboxes were removed due to unchecked box at line %d" (org-current-line block-item))) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe) (when firstp (org-list-send-list (quote maybe))))) ((org-at-item-p) (let* ((struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (firstp (= (org-list-get-top-point struct) (point-at-bol)))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (when arg (org-list-set-checkbox (point-at-bol) struct "[ ]") (org-list-struct-fix-box struct parents prevs)) (org-list-struct-apply-struct struct old-struct) (when arg (org-update-checkbox-count-maybe)) (when firstp (org-list-send-list (qu
 ote maybe))))) ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) (beginning-of-line 1) (save-excursion (org-update-dblock))) ((save-excursion (beginning-of-line 1) (lo
 oking-at "[ 	]*#\\+\\([A-Z]+\\)")) (cond ((equal (match-string 1) "TBLFM") (save-excursion (beginning-of-line 1) (skip-chars-backward " 
\n	") (if (org-at-table-p) (org-call-with-arg (quote org-table-recalculate) (or arg t))))) (t (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (org-save-outline-visibility (quote use-markers) (org-mode-restart))) (message "Local setup has been refreshed")))) ((org-clock-update-time-maybe)) (t (error "C-c C-c can do nothing useful at this location")))
  (let ((org-enable-table-editor t)) (cond ((or (and (boundp (quote org-clock-overlays)) org-clock-overlays) org-occur-highlights org-latex-fragment-image-overlays) (and (boundp (quote org-clock-overlays)) (org-clock-remove-overlays)) (org-remove-occur-highlights) (org-remove-latex-fragment-image-overlays) (message "Temporary highlights/overlays removed from current buffer")) ((and (local-variable-p (quote org-finish-function) (current-buffer)) (fboundp org-finish-function)) (funcall org-finish-function)) ((run-hook-with-args-until-success (quote org-ctrl-c-ctrl-c-hook))) ((or (looking-at org-property-start-re) (org-at-property-p)) (call-interactively (quote org-property-action))) ((org-on-target-p) (call-interactively (quote org-update-radio-target-regexp))) ((and (org-in-regexp "\\[\\([0
 -9]*%\\|[0-9]*/[0-9]*\\)\\]") (or (org-on-heading-p) (org-at-item-p))) (call-interactively (quote org-update-statistics-cookies))) ((org-on-heading-p) (call-interactively (quote org-set-tags
 ))) ((org-at-table\.el-p) (message "Use C-c ' to edit table.el tables")) ((org-at-table-p) (org-table-maybe-eval-formula) (if arg (call-interactively (quote org-table-recalculate)) (org-table-maybe-recalculate-line)) (call-interactively (quote org-table-align)) (orgtbl-send-table (quote maybe))) ((or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) (call-interactively (quote org-footnote-action))) ((org-at-item-checkbox-p) (let* ((cbox (match-string 1)) (struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (orderedp (org-entry-get nil "ORDERED")) (firstp (= (org-list-get-top-point struct) (point-at-bol))) block-item) (org-list-set-checkbox (point-at-bol) struct (cond ((equal arg ...) "[-]") (
 (equal arg ...) nil) ((equal "[ ]" cbox) "[X]") (t "[ ]"))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (setq block-item (org-list-struct-fix-box struct p
 arents prevs orderedp)) (when block-item (message "Checkboxes were removed due to unchecked box at line %d" (org-current-line block-item))) (org-list-struct-apply-struct struct old-struct) (org-update-checkbox-count-maybe) (when firstp (org-list-send-list (quote maybe))))) ((org-at-item-p) (let* ((struct (org-list-struct)) (old-struct (copy-tree struct)) (parents (org-list-parents-alist struct)) (prevs (org-list-prevs-alist struct)) (firstp (= (org-list-get-top-point struct) (point-at-bol)))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (when arg (org-list-set-checkbox (point-at-bol) struct "[ ]") (org-list-struct-fix-box struct parents prevs)) (org-list-struct-apply-struct struct old-struct) (when arg (org-update-checkbox-count-maybe)) (when firstp (org
 -list-send-list (quote maybe))))) ((save-excursion (beginning-of-line 1) (looking-at org-dblock-start-re)) (beginning-of-line 1) (save-excursion (org-update-dblock))) ((save-excursion (begin
 ning-of-line 1) (looking-at "[ 	]*#\\+\\([A-Z]+\\)")) (cond ((equal (match-string 1) "TBLFM") (save-excursion (beginning-of-line 1) (skip-chars-backward " 
\n	") (if (org-at-table-p) (org-call-with-arg ... ...)))) (t (let ((org-inhibit-startup-visibility-stuff t) (org-startup-align-all-tables nil)) (org-save-outline-visibility (quote use-markers) (org-mode-restart))) (message "Local setup has been refreshed")))) ((org-clock-update-time-maybe)) (t (error "C-c C-c can do nothing useful at this location"))))
  org-ctrl-c-ctrl-c(nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)

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

* Re: org-collector calculated rows?
  2011-03-05  8:43 ` Nick Dokos
@ 2011-03-05  8:48   ` Nick Dokos
  2011-03-10  5:21     ` Rehan Iftikhar
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2011-03-05  8:48 UTC (permalink / raw)
  Cc: nicholas.dokos, emacs-orgmode, Rehan Iftikhar

> Rehan Iftikhar <rehan.iftikhar@gmail.com> wrote:
> 
> >   * More Complex Example: displaying the mean of the "Amount" column
> > for each week.
> > 

I see that I misread this: the formula calculates the mean of all the entries,
not the mean for each week. Having thought about it for about 10 seconds,
I cannot think of a way to do that.

Nick

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

* Re: org-collector calculated rows?
  2011-03-05  8:48   ` Nick Dokos
@ 2011-03-10  5:21     ` Rehan Iftikhar
  2011-03-10  5:46       ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Rehan Iftikhar @ 2011-03-10  5:21 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

I have tried adding

 #+TBLFM: @>$>=vmean(I..II)

between the #+BEGIN and #+END lines (after generating a table), but
when I C-c C-c on #+BEGIN, the table refreshes and removes the #+TBLFM
line.

I am using org-mode 7.4. Any idea why my formula isn't working?

-Rehan

On Sat, Mar 5, 2011 at 12:48 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
>> Rehan Iftikhar <rehan.iftikhar@gmail.com> wrote:
>>
>> >   * More Complex Example: displaying the mean of the "Amount" column
>> > for each week.
>> >
>
> I see that I misread this: the formula calculates the mean of all the entries,
> not the mean for each week. Having thought about it for about 10 seconds,
> I cannot think of a way to do that.
>
> Nick
>



-- 
-Rehan

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

* Re: org-collector calculated rows?
  2011-03-10  5:21     ` Rehan Iftikhar
@ 2011-03-10  5:46       ` Nick Dokos
  2011-03-10  7:14         ` Rehan Iftikhar
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Dokos @ 2011-03-10  5:46 UTC (permalink / raw)
  To: Rehan Iftikhar; +Cc: nicholas.dokos, emacs-orgmode

Rehan Iftikhar <rehan.iftikhar@gmail.com> wrote:

> I have tried adding
> 
>  #+TBLFM: @>$>=vmean(I..II)
> 
> between the #+BEGIN and #+END lines (after generating a table), but
> when I C-c C-c on #+BEGIN, the table refreshes and removes the #+TBLFM
> line.
> 
> I am using org-mode 7.4. Any idea why my formula isn't working?
> 

I don't know why the #+TBLFM line disappears: it does not in my case -
assuming that I've got org-collector loaded: since it's a contrib
package it's not loaded automatically for me and when I tried the
refresh before loading org-collector, *everything* disappeared: the
table and the formula. But once I got the package loaded correctly,
things worked as I described before: if only the formula is in there, it
gets wiped out, but if there is a table along with the formula, the
table gets refreshed and the formula is recalculated.

BTW, the formula is wrong: it should read

--8<---------------cut here---------------start------------->8---
#+TBLFM: @>$>=vmean(@I..II)
--8<---------------cut here---------------end--------------->8---

and that also assumes that you are running a very recent version of org,
one that recognizes @> and $>. But neither of these would explain why
the formula is wiped.

Nick

PS. I'm using Eric Schulte's standard example from the Worg site:

--8<---------------cut here---------------start------------->8---
* Example

#+BEGIN: propview :id "december" :conds ((string= spendtype "food")) :cols (ITEM amount)
| "ITEM"                           | "amount" |
|----------------------------------+----------|
| "Grocery Store [2008-12-01 Mon]" |    56.77 |
| "Restaurant [2008-12-08 Mon]"    |    30.67 |
| "Grocery Store [2008-12-09 Tue]" |    56.76 |
|----------------------------------+----------|
|                                  |          |
#+TBLFM: @>$>=vmean(@I..II)
#+END:



#+BEGIN: propview :cols (ITEM (+ 400 amount)) :scope tree :match "example"
| "ITEM"                           | "(+ 400 amount)" |
|----------------------------------+------------------|
| "December Spending"              |                0 |
| "Week One"                       |                0 |
| "Grocery Store [2008-12-01 Mon]" |           456.77 |
| "Athletic club [2008-12-02 Tue]" |            475.0 |
| "Week Two "                      |                0 |
| "Restaurant [2008-12-08 Mon]"    |           430.67 |
| "Grocery Store [2008-12-09 Tue]" |           456.76 |
|----------------------------------+------------------|
|                                  |        259.88571 |
#+TBLFM: @>$>=vmean(@I..II)
#+END:
#+TBLFM: @>$> = vmean(@I..II)
** December Spending						       :example:
   :PROPERTIES:
   :ID:       december
   :END:

*** Week One
**** Grocery Store [2008-12-01 Mon]
     :PROPERTIES:
     :amount: 56.77
     :spendtype: food
     :END:
**** Athletic club [2008-12-02 Tue]
     :PROPERTIES:
     :amount: 75.00
     :spendtype: health
     :END:
*** Week Two 
**** Restaurant [2008-12-08 Mon]
     :PROPERTIES:
     :amount: 30.67
     :spendtype: food
     :END:
**** Grocery Store [2008-12-09 Tue]
     :PROPERTIES:
     :amount: 56.76
     :spendtype: food
     :END:
--8<---------------cut here---------------end--------------->8---

> 
> On Sat, Mar 5, 2011 at 12:48 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> >> Rehan Iftikhar <rehan.iftikhar@gmail.com> wrote:
> >>
> >> >   * More Complex Example: displaying the mean of the "Amount" column
> >> > for each week.
> >> >
> >
> > I see that I misread this: the formula calculates the mean of all the entries,
> > not the mean for each week. Having thought about it for about 10 seconds,
> > I cannot think of a way to do that.
> >
> > Nick
> >
> 
> 
> 
> -- 
> -Rehan
> 

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

* Re: org-collector calculated rows?
  2011-03-10  5:46       ` Nick Dokos
@ 2011-03-10  7:14         ` Rehan Iftikhar
  0 siblings, 0 replies; 6+ messages in thread
From: Rehan Iftikhar @ 2011-03-10  7:14 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

I updated to 7.5, recompiled, and now it works!

Thanks for the help!


On Wed, Mar 9, 2011 at 9:46 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Rehan Iftikhar <rehan.iftikhar@gmail.com> wrote:
>
>> I have tried adding
>>
>>  #+TBLFM: @>$>=vmean(I..II)
>>
>> between the #+BEGIN and #+END lines (after generating a table), but
>> when I C-c C-c on #+BEGIN, the table refreshes and removes the #+TBLFM
>> line.
>>
>> I am using org-mode 7.4. Any idea why my formula isn't working?
>>
>
> I don't know why the #+TBLFM line disappears: it does not in my case -
> assuming that I've got org-collector loaded: since it's a contrib
> package it's not loaded automatically for me and when I tried the
> refresh before loading org-collector, *everything* disappeared: the
> table and the formula. But once I got the package loaded correctly,
> things worked as I described before: if only the formula is in there, it
> gets wiped out, but if there is a table along with the formula, the
> table gets refreshed and the formula is recalculated.
>
> BTW, the formula is wrong: it should read
>
> --8<---------------cut here---------------start------------->8---
> #+TBLFM: @>$>=vmean(@I..II)
> --8<---------------cut here---------------end--------------->8---
>
> and that also assumes that you are running a very recent version of org,
> one that recognizes @> and $>. But neither of these would explain why
> the formula is wiped.
>
> Nick
>
> PS. I'm using Eric Schulte's standard example from the Worg site:
>
> --8<---------------cut here---------------start------------->8---
> * Example
>
> #+BEGIN: propview :id "december" :conds ((string= spendtype "food")) :cols (ITEM amount)
> | "ITEM"                           | "amount" |
> |----------------------------------+----------|
> | "Grocery Store [2008-12-01 Mon]" |    56.77 |
> | "Restaurant [2008-12-08 Mon]"    |    30.67 |
> | "Grocery Store [2008-12-09 Tue]" |    56.76 |
> |----------------------------------+----------|
> |                                  |          |
> #+TBLFM: @>$>=vmean(@I..II)
> #+END:
>
>
>
> #+BEGIN: propview :cols (ITEM (+ 400 amount)) :scope tree :match "example"
> | "ITEM"                           | "(+ 400 amount)" |
> |----------------------------------+------------------|
> | "December Spending"              |                0 |
> | "Week One"                       |                0 |
> | "Grocery Store [2008-12-01 Mon]" |           456.77 |
> | "Athletic club [2008-12-02 Tue]" |            475.0 |
> | "Week Two "                      |                0 |
> | "Restaurant [2008-12-08 Mon]"    |           430.67 |
> | "Grocery Store [2008-12-09 Tue]" |           456.76 |
> |----------------------------------+------------------|
> |                                  |        259.88571 |
> #+TBLFM: @>$>=vmean(@I..II)
> #+END:
> #+TBLFM: @>$> = vmean(@I..II)
> ** December Spending                                                   :example:
>   :PROPERTIES:
>   :ID:       december
>   :END:
>
> *** Week One
> **** Grocery Store [2008-12-01 Mon]
>     :PROPERTIES:
>     :amount: 56.77
>     :spendtype: food
>     :END:
> **** Athletic club [2008-12-02 Tue]
>     :PROPERTIES:
>     :amount: 75.00
>     :spendtype: health
>     :END:
> *** Week Two
> **** Restaurant [2008-12-08 Mon]
>     :PROPERTIES:
>     :amount: 30.67
>     :spendtype: food
>     :END:
> **** Grocery Store [2008-12-09 Tue]
>     :PROPERTIES:
>     :amount: 56.76
>     :spendtype: food
>     :END:
> --8<---------------cut here---------------end--------------->8---
>
>>
>> On Sat, Mar 5, 2011 at 12:48 AM, Nick Dokos <nicholas.dokos@hp.com> wrote:
>> >> Rehan Iftikhar <rehan.iftikhar@gmail.com> wrote:
>> >>
>> >> >   * More Complex Example: displaying the mean of the "Amount" column
>> >> > for each week.
>> >> >
>> >
>> > I see that I misread this: the formula calculates the mean of all the entries,
>> > not the mean for each week. Having thought about it for about 10 seconds,
>> > I cannot think of a way to do that.
>> >
>> > Nick
>> >
>>
>>
>>
>> --
>> -Rehan
>>
>



-- 
-Rehan

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

end of thread, other threads:[~2011-03-10  7:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 16:16 org-collector calculated rows? Rehan Iftikhar
2011-03-05  8:43 ` Nick Dokos
2011-03-05  8:48   ` Nick Dokos
2011-03-10  5:21     ` Rehan Iftikhar
2011-03-10  5:46       ` Nick Dokos
2011-03-10  7:14         ` Rehan Iftikhar

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