emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Help with org-lookup-all
@ 2014-09-03  1:24 Alan L Tyree
  2014-09-03  5:04 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Alan L Tyree @ 2014-09-03  1:24 UTC (permalink / raw)
  To: emacs-orgmode

I feel so dumb!

I have this expession attached to a table: (org-lookup-all $1 
'(remote(payments,@2$4..@>$4)) '(remote(payments,@2$2..@>$2)))

It is returning the right list of numbers since I can examine them with 
(nth n ....

How do I add the list up? I keep getting #ERROR or obviously wrong 
answers. What I want is something like

  $2='(apply '+ (org-lookup-all $1 '(remote(payments,@2$4..@>$4)) 
'(remote(payments,@2$2..@>$2))))

but that gives me errors since (I presume) the list is a bunch of strings.

Thanks for any help,
Alan

-- 
Alan L Tyree                    http://www2.austlii.edu.au/~alan
Tel:  04 2748 6206              sip:typhoon@iptel.org

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

* Re: Help with org-lookup-all
  2014-09-03  1:24 Help with org-lookup-all Alan L Tyree
@ 2014-09-03  5:04 ` Nick Dokos
  2014-09-03  6:18   ` Alan L Tyree
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2014-09-03  5:04 UTC (permalink / raw)
  To: emacs-orgmode

Alan L Tyree <alantyree@gmail.com> writes:

> I feel so dumb!
>
> I have this expession attached to a table: (org-lookup-all $1
> '(remote(payments,@2$4..@>$4)) '(remote(payments,@2$2..@>$2)))
>
> It is returning the right list of numbers since I can examine them
> with (nth n ....
>
> How do I add the list up? I keep getting #ERROR or obviously wrong
> answers. What I want is something like
>
>  $2='(apply '+ (org-lookup-all $1 '(remote(payments,@2$4..@>$4))
> '(remote(payments,@2$2..@>$2))))
>
> but that gives me errors since (I presume) the list is a bunch of strings.
>

If they *are* a bunch of strings, then mapping string-to-number across the
list should do the trick:


 $2='(apply '+ (mapcar (function string-to-number) (org-lookup-all $1 '(remote(payments,@2$4..@>$4)) '(remote(payments,@2$2..@>$2)))))

-- 
Nick

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

* Re: Help with org-lookup-all
  2014-09-03  5:04 ` Nick Dokos
@ 2014-09-03  6:18   ` Alan L Tyree
  0 siblings, 0 replies; 3+ messages in thread
From: Alan L Tyree @ 2014-09-03  6:18 UTC (permalink / raw)
  To: emacs-orgmode


On 03/09/14 15:04, Nick Dokos wrote:
> Alan L Tyree <alantyree@gmail.com> writes:
>
>> I feel so dumb!
>>
>> I have this expession attached to a table: (org-lookup-all $1
>> '(remote(payments,@2$4..@>$4)) '(remote(payments,@2$2..@>$2)))
>>
>> It is returning the right list of numbers since I can examine them
>> with (nth n ....
>>
>> How do I add the list up? I keep getting #ERROR or obviously wrong
>> answers. What I want is something like
>>
>>   $2='(apply '+ (org-lookup-all $1 '(remote(payments,@2$4..@>$4))
>> '(remote(payments,@2$2..@>$2))))
>>
>> but that gives me errors since (I presume) the list is a bunch of strings.
>>
> If they *are* a bunch of strings, then mapping string-to-number across the
> list should do the trick:
>
>
>   $2='(apply '+ (mapcar (function string-to-number) (org-lookup-all $1 '(remote(payments,@2$4..@>$4)) '(remote(payments,@2$2..@>$2)))))
>

That worked a treat - thanks Nick.

Cheers,
Alan

-- 
Alan L Tyree                    http://www2.austlii.edu.au/~alan
Tel:  04 2748 6206              sip:typhoon@iptel.org

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

end of thread, other threads:[~2014-09-03  6:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-03  1:24 Help with org-lookup-all Alan L Tyree
2014-09-03  5:04 ` Nick Dokos
2014-09-03  6:18   ` Alan L Tyree

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