go to post Iryna Mykhailova · Jan 5 For something like this, you can use a Learning Lab, it's free: https://learning.intersystems.com/course/view.php?id=929
go to post Iryna Mykhailova · Nov 17, 2023 The command doesn't know. That's why you need to check the SQLCODE variable. If SQLCODE = 0 then the row exists and it was updated. If SQLCODE = 100 then the row doesn't exist. If it not equal to either then you have a problem. Example for Embedded SQL: &SQL(update WH.Size set Height = 1000 where %ID = 10) write SQLCODE Example for Dynamic SQL: SET myquery = "update WH.Size set Height = 1000 where %ID = 10" SET tStatement = ##class(%SQL.Statement).%New() SET tStatus = tStatement.%Prepare(myquery) SET rset = tStatement.%Execute() write rset.%SQLCODE Not sure what you mean by "if the row exists" in regards with insert. The row does not exist, because you're creating it.
go to post Iryna Mykhailova · Aug 24, 2023 Yep, that was my first thought - can you change Property Organizations As list Of Organization; to parent/children Relationship? In this case you will get automatic cascade delete. You'll have Relationship Responce As GetOrgUpdatesResponse [ Cardinality = parent, Inverse = Organizations ]; Relationship Organizations As Organization [ Cardinality = children, Inverse = Responce ]; And it suggests that each responce has its own organizations objects that don't repeat. Otherwise, you will have to delete them manually 1 by 1 in callback method %OnDelete for example /// This callback method is invoked by the <METHOD>%Delete</METHOD> method to /// provide notification that the object specified by <VAR>oid</VAR> is being deleted. /// /// If this method returns an error then the object will not be deleted. ClassMethod %OnDelete(oid As %ObjectIdentity) As %Status [ Private, ServerOnly = 1 ] { Quit $$$OK }
go to post Iryna Mykhailova · Jun 14, 2023 You're not executing it: vism1.Execute(cmd); To make it shorter, can be vism1.Execute('$$Check^logininput()'); sResult:=vism1.Value; You can also find an example in this GitHub repository.