How do you export a table using cache object script?

127 views
Skip to first unread message

Lyle

unread,
Mar 6, 2009, 5:44:04 PM3/6/09
to intersystems...@info2.kinich.com
How do you export a table using cache object script?

I have a class called "Names" that holds the First and Last Name and I want
to be able to export the table to a file using Cache Object Script.

Thanks,

Lyle

Sukesh Hoogan

unread,
Mar 6, 2009, 10:13:00 PM3/6/09
to intersystems...@info2.kinich.com
Lyle

You need to use %SQL.Export.Mgr class

http://localhost:57772/csp/documatic/%25CSP.Documatic.cls?PAGE=CLASS&LIBRARY=%25SYS&CLASSNAME=%25SQL.Export.Mgr

Tweak the following and try

set mx=##class(%SQL.Export.Mgr).%New()
set mx.FileName="C:\My Documents\MyNewClass.txt"
set mx.TableName="MyNewClass"
set mx.ClassName="SQLUser.MyNewClass"
set mx.HasHeaders=1
do mx.ColumnNames.Insert("FirstName")
do mx.ColumnNames.Insert("LastName")
do mx.ColumnTypes.Insert("S")
do mx.ColumnTypes.Insert("S")
set mx.Delimiter=":"
set mx.StringQuote="#"
do mx.Export(1)
do mx.CloseExport()
kill mx

Regards
Sukesh Hoogan
Bombay, India
- Enterprise Resource Planning
- Business Intelligence
- Financial Accounting
- Offshore Development

Lyle

unread,
Mar 7, 2009, 10:11:49 AM3/7/09
to intersystems...@info2.kinich.com
Thanks for the info Sukesh

Lyle

"Sukesh Hoogan" <sukesh...@yahoo.co.in> wrote in message
news:goso7e$me7$1...@news.intersystems.com...

Reply all
Reply to author
Forward
0 new messages