emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Applying a user-defined function to cols in table


From: charles snyder
Subject: [Orgmode] Applying a user-defined function to cols in table
Date: Fri, 12 Sep 2008 20:49:23 -0500

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]