emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Applying a user-defined function to cols in table
@ 2008-09-13  1:49 charles snyder
  2008-09-13  4:19 ` Nick Dokos
  0 siblings, 1 reply; 2+ messages in thread
From: charles snyder @ 2008-09-13  1:49 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 943 bytes --]

Hi

I am trying to apply a function to one column in a table and output the
result to another column. The function looks like this:

(defun yahoo (stock_symbol)
   (let (url contents fields price-string price)
     (setf url "http://finance.yahoo.com/d/quotes.csv?s=")
     (str+! url stock_symbol)
     (str+! url "&f=sl1d1t1c1ohgv&e=.csv")
     (setf contents (http-get url))
     (setf fields (split-sequence #\, contents))
     (setf price-string (second fields))
     (setf price (read-from-string price-string))
     price))


This table looks like this:

|  !   | stockname | symbol | shares | curr_price |
|  1  |      apple     | aapl   |    800 |            |
|  2  |    google       | goog  |   2100 |         |
#+TBLFM: $5= yahoo $3

(I'm using org 6.06b, gnu emacs 22.2 on a mac.)


I have tried some other variants without success.
Is this even possible?

Thanks!

-- 
Charles L. Snyder, MD
Professor of Surgery
www.clsnyder.com

[-- Attachment #1.2: Type: text/html, Size: 1616 bytes --]

[-- Attachment #2: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: 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] 2+ messages in thread

end of thread, other threads:[~2008-09-13  4:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-13  1:49 Applying a user-defined function to cols in table charles snyder
2008-09-13  4:19 ` Nick Dokos

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