Question
· May 17, 2023

Identity property - CacheSQLStorage

Hello,

We have recently encountered an issue which requires us to define a new identity field (named xMDA in the attached example), instead of using the default ID field.

We need to run an SQL query which unfortunately overrides the ID field (see attached image) but we still need to be able to access the ID field in said query.

We are however unable to get the attached solution to work. Is there a way to get around this issue?

 

 

Class TafnitCore.System.MDA.USER.caghoNybdWE1x0wt0DpyXVMhA5Yx2x2 Extends %Persistent [ ProcedureBlock, StorageStrategy = MainStorage ]
{

Property xMDA As %Integer [ Identity ];

Property Subscript1 As %String;

Property Subscript2 As %String;

Property Data As %String(MAXLEN = 32000);

Property ZREF As %String [ Calculated, SqlComputeCode = { {*} = ##class(TafnitCore.System.Utils.CacheUtils).getZREF("^[""USER""]ASORT",{ID})}, SqlComputed, Transient ];

Index PMKey On (Subscript1, Subscript2) [ IdKey, PrimaryKey, Unique ];

Storage MainStorage
{
<SQLMap name="MainMap">
<Data name="Data">
<Delimiter>"$c(31)"</Delimiter>
<Piece>1</Piece>
</Data>
<Global>^["USER"]ASORT</Global>
<Subscript name="1">
<Expression>{Subscript1}</Expression>
</Subscript>
<Subscript name="2">
<Expression>{Subscript2}</Expression>
</Subscript>
<Type>data</Type>
</SQLMap>
<StreamLocation>^["USER"]ASORT.S</StreamLocation>
<Type>%CacheSQLStorage</Type>
} }
 

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