Example!

Class:

------------------------------------------

Class Jiri.RegisteredObject extends %RegisteredObject {

Property p1;

Property p2;

}

------------------------------------------

Terminal:

------------------------------------------

SAMPLES>s j=##class(Jiri.RegisteredObject).%New()

SAMPLES>s j.p1="test"

SAMPLES>s j.p2="json"

SAMPLES>w ##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONStreamFromObject(.stream,j)

1

SAMPLES>w stream.Read()

{

"_class":"Jiri.RegisteredObject",

"p1":"test",

"p2":"json"

}

------------------------------------------

Do your CSP Files show up in the Server Explorer portion of Atelier?  Also, what is your Atelier version (Atelier->About Atelier)?

P.S. I think that was the most I've ever written "Atelier" in a short time.

I'm pretty sure you need to return an oref to get this working.  Here's one that I was able to get working:

Class Sample.SerialGet Extends %Persistent {
Property Address as Sample.Address [calculated];

Method AddressGet() as Sample.Address {  
    set a=##class(Sample.Address).%New()  
    set a.City="Cambridge"  
    set a.State="MA"  
    set a.Zip="02142"  
    set a.Street="1 Memorial Drive"  
    quit a
}
}

Terminal:

SAMPLES>s reader=##class(%XML.Reader).%New()

SAMPLES>w reader.OpenFile("/users/kbaxter/downloads/testopensinglequote.xml")

1

SAMPLES>s x=##class(Sample.SerialGet).%New()

SAMPLES>w x.Address

5@Sample.Address

SAMPLES>w x.Address.Street

1 Memorial Drive

I think the best way to do this would be to write something in COS, write a class query with it, and use that as a Table Valued Function.  While there might be a relational way to do this, it seems like it'd be messy.

Caché does NOT support SQL-92 in its full implementation, so please refrain from saying so.  Example:

SELECT 3+3*3

Result: 18

Clearly, by not following order of operations we are violating the standard.  Moreover, despite not conforming perfectly to SQL-92 we do support plenty of extensions, such as Table-Valued Functions.

That said, Caché does not support WITH in the way you describe.  However, you can accomplish the same thing by using subqueries, VIEWs, or multiple queries.  You can also JOIN each record with its parent and filter on that.  If you give some more information I'd be happy to point you in the right direction.

If you want to investigate the performance of the query you can always open a WRC Case (wrc.intersystems.com :-D).

Otherwise, send out your class definition and query plan and I can take a cursory look at it.

I actually baked a cake to commemorate this occasion, and totally not because I'm fat and wanted cake.

Well, if you want good performance in SQL Queries, you need indexes.  What do your tables look like?  We can definitely get fast performance on a 50M row table, it might just take some work (which we're happy to help with).

Sure - you can try to merge it off before deleting it:

m ^KMB = ^%sqlcq("NSP","SMPQueryHistory")
 

And then you have your query history in a different global, which you can reference when needed.