I need to consume the content of ^SPOOL output over SQL.
^%SPOOL utilities don't look so promising
I need to consume the content of ^SPOOL output over SQL.
^%SPOOL utilities don't look so promising
Simply map the ^SPOOL global to a class and get a table %ZZ.SPOOL
like this:
/// Get SQL Access to ^SPOOL
Class %ZZ.SPOOL Extends %Persistent [ Final, SqlRowIdPrivate, StorageStrategy = SpoolSQL ]
{
Property Document As %Integer [ ReadOnly ];
Property LineNumber As %Integer [ ReadOnly ];
Property Text As %String(MAXLEN = "") [ ReadOnly ];
Index idx On (Document, LineNumber) [ IdKey ];
Storage SpoolSQL
{
<SQLMap name="Spool">
<Data name="Text">
<Delimiter>$c(13)_$c(10)</Delimiter>
<Piece>1</Piece>
</Data>
<Global>^SPOOL</Global>
<Subscript name="1">
<Expression>{Document}</Expression>
</Subscript>
<Subscript name="2">
<Expression>{LineNumber}</Expression>
</Subscript>
<Type>data</Type>
</SQLMap>
<StreamLocation>^SPOOLS</StreamLocation>
<Type>%Storage.SQL</Type>
} }
To leave a comment or answer to post please log in
Please log in
Perfect !
Any reason why you use
instead of:
?
@ some version in past the code generator struggled with $c(13,10) disliking the "," for some reason.
Hi,
In Ensemble what would be a real life scenario where we can make use of spooling?
Thanks
every log or similar document that should not see your OS environment is a candidate for SPOOL
eg. sequentially collected by assigning dedicate doc numbers.