Hey All,
I've got some code that exports a table to a csv file. It works great except in certain situations where there's a quote in an attribute (which are actually inch marks). If there's a quote in the attribute, it combines the "DESCRIPTION" attribute with the "QTY" attribute, resulting in:
COPPER TUBING - TYPE L - HARD - 1-3/8",8"
where it should be:
COPPER TUBING - TYPE L - HARD - 1-3/8"
(and 8 as another separate value)
I'm having a hard time figuring out how to get the code to ignore the quotes in the attributes . Would anyone mind taking a look and seeing if they can spot what's wrong? I can see where the error is (below, in red), but I can't see how the error is...
Attributes:
DESCRIPTION
COPPER TUBING - TYPE L - HARD - 1-3/8"
QTY
8
Code:
(progn
(if (findfile filePath)
(progn
(prompt "\nFile found, deleting... ")
(vl-file-delete filePath)
(princ "Done.")
)
)
(setq file (open filePath "w"))
(setq row 0)
(while (< (setq row (1+ row)) (vla-get-rows oTable))
(setq col -1)
(setq str "")
(while (< (setq col (1+ col)) (vla-get-columns oTable))
(setq str (strcat str ",\"" (vla-gettext oTable row col) "\""))
)
(write-line (vl-string-left-trim "," str) file)
)
(princ "\nTable sucsessfully exported.")
)
Thanks a heap!
-stu