Question
· Jun 28, 2016

Joins in SQL Computed Code specification?

Hi -

I have 3 classes: "Class A" has a property X, "Class B" has a property which is a Class A, and I have a "Class C" which has a property of a Class B.

Class A definition

Class USER.ClassA Extends %Persistent

{

Property Propx as %String;

}

Class B definition

Class USER.ClassB Extends %Persistent

{

Property Record as USER.ClassA;

}

Class C defintion (which is where I'm having my problem)

Class USER.ClassC Extends %Persistent

{

Property BRecord As USER.ClassB;

Property ARecord As USER.ClassA [ Calculated, SqlComputeCode = { ????? }, SqlComputed ];

Method ARecordGet() as USER.ClassA

{

 quit ..BRecord.ARecord

}

}

What I'm trying to figure out is, how can I define a property that is a calculated and SQL Computed property in Class C that would show the Class B's Class A value, but I can't find a syntax that works.

{ set {ARecord}={BRecord.ARecord} } doesn't work, nor does

{ set {ARecord}={BRecord->ARecord} }, nor does

{ set {ARecord}={BRecord}.{ARecord} }, nor does

{ set {ARecord}={BRecord}->{ARecord} } 

Before I put in an overt method call (with all of the overhead associated with that) I thought I would ask if there is some sort of curly-braced acceptable form that would work.

Discussion (5)1
Log in or sign up to continue

Attila, can you please elaborate on why it is potentially dangerous to refer to data outside of current record unless Calculated is specified?

I personally use Calculated only when property value might change during oref lifetime. If property value is not changed once object is in process memory, then there is no need for Calculated, as I understand -- Transient is enough.