Reputation: 790
I have data in global in this format:
^kza("mltab","TAB","Dta",1,1) = 3341
^kza("mltab","TAB","Dta",1,2) = "First Name"
^kza("mltab","TAB","Dta",1,3) = "type1"
^kza("mltab","TAB","Dta",1,4) = 7400.11
^kza("mltab","TAB","Dta",2,1) = 3614
^kza("mltab","TAB","Dta",2,2) = "Second Name"
^kza("mltab","TAB","Dta",2,3) = "type2"
^kza("mltab","TAB","Dta",2,4) = 7600.11
My object class looks like this:
Class Kza.Employees Extends %Persistent [ StorageStrategy = EmpStorage ]
{
Property num As %Integer; //unique identifier
Property id As %Integer;
Property num As %Integer;
Property name As %String;
Property type As %String;
Property pay As %Double;
Index NewIndex1 On id [ IdKey, PrimaryKey, Unique ];
<Storage name="EmpStorage">
<ExtentSize>100000</ExtentSize>
<SequenceNumber>8</SequenceNumber>
<SQLMap name="MasterMap">
<ConditionalWithHostVars></ConditionalWithHostVars>
<Data name="num">
<Node>1</Node>
</Data>
<Data name="name">
<Node>2</Node>
</Data>
<Data name="pay">
<Node>4</Node>
</Data>
<Data name="type">
<Node>3</Node>
</Data>
<Global>^kza</Global>
<RowIdSpec name="1">
<Expression>{L1}</Expression>
<Field>id</Field>
</RowIdSpec>
<Subscript name="1">
<Expression>"mltab"</Expression>
</Subscript>
<Subscript name="2">
<Expression>"TAB"</Expression>
</Subscript>
<Subscript name="3">
<Expression>"Dta"</Expression>
</Subscript>
<Subscript name="4">
<Expression>{id}</Expression>
</Subscript>
<Type>data</Type>
</SQLMap>
<StreamLocation>^Kza.EmployeesS</StreamLocation>
<Type>%CacheSQLStorage</Type>
</Storage>
}
The problem is that if I do
insert into Kza.Employees(id, num, name, pay, type) VALUES(132, 3214, 'Name Second', 89000, 'type5')
the result is:
^kza("mltab","TAB","Dta",1) = ""
^kza("mltab","TAB","Dta",1,1) = 3214
^kza("mltab","TAB","Dta",1,2) = "Name Second"
^kza("mltab","TAB","Dta",1,3) = 'type 5'
^kza("mltab","TAB","Dta",1,4) = 89000
But i need to don't have saved the first line, so HOW TO ELIMINATE SAVE THIS NODE:
^kza("mltab","TAB","Dta",1) = ""
Upvotes: 0
Views: 276
Reputation: 36
Try making the num, name, type, or pay property required (if there are any that cannot be null).
Caché defines the ^kza("mltab","TAB","Dta",1) node because if the other 4 field are all null, the existence of the ^kza("mltab","TAB","Dta",1) node defines the existence of the row.
In other words, if num, name, type, or pay are all null and ^kza("mltab","TAB","Dta",1) is not defined, the row would not be defined.
Upvotes: 2