PDA

View Full Version : Any lisp example to read CSV file & import to Annotation?


Leekhinc
12-22-2003, 11:16 PM
Does anyone know of any lisp example that can read a comma seperated variable (CSV) file and import them to OSD Annotation screen as a text?

I actually created some lisp code as below.

(with-open-file (a "d:/doc/test.csv"
:direction :input)

(loop while (setq b (read-line a) do
(sd-string-split b ",")
(am_create_text :go :ok :owner am_geo_set_domain :prompt-var "VIEW" :current-sheet "Act Sheet" :go :ok b )))
)

However, I could not really get it running because of some lisp error stating that the function sd-string-split is undefined.

The content of test.csv looks like below.
1,2,3,4
2,3,4,5

Does anybody has any clues?

Thanks in advance.

clausb
12-23-2003, 01:06 AM
sd-string-split is in the oli package, so to use it, add a "(use-package :oli)" command to the beginning of your source file, or prefix the call to sd-string-split with oli: as in "(oli:sd-string-split whateverparameters)".

For more on Common LISP packages, see http://www.lisp.org/HyperSpec/Body/chap-11.html and http://psg.com/%7Edlamkins/sl/chapter03-10.html

Claus